Skip to main content

Parsing text output for Advent of Code puzzles

Project description

Advent of Code Optical Character Recognition (adventocr)

Some Advent of Code puzzles provide visual outputs which must be converted into text. This package is a helper to automate this task.

Installation

pip install adventocr

Usage

An example puzzle output may look something like

word = [
    '#', '#', '#', '#', ' ', '#', '#', '#', '#', ' ',
    '#', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ',
    '#', '#', '#', ' ', ' ', '#', '#', '#', ' ', ' ',
    '#', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ',
    '#', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ',
    '#', '#', '#', '#', ' ', '#', ' ', ' ', ' ', ' '
]

When tidied and printed, this appears to be

#### #### 
#    #    
###  ###  
#    #    
#    #    
#### #

This process can be automated through:

import adventocr
parsed = adventocr.word(word)
parsed
'EF' 

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adventocr-0.1.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

adventocr-0.1-py3-none-any.whl (5.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page