Metadata-Version: 2.4
Name: advent-of-code-ocr
Version: 1.1.0
Summary: A library to parse Advent of Code ASCII art
Project-URL: Changelog, https://github.com/bsoyka/advent-of-code-ocr/releases
Project-URL: Source, https://github.com/bsoyka/advent-of-code-ocr
Author-email: Ben Soyka <hello@bsoyka.me>
License-File: LICENSE
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Requires-Dist: click>=8.2.1
Description-Content-Type: text/markdown

# Advent of Code® OCR

This Python module converts [Advent of Code](https://adventofcode.com/) ASCII
art letters to plain characters.

At the moment, it supports 6-pixel-tall characters as seen in 2016 Day 8, 2019
Days 8 and 11, and 2021 Day 13. (Support for 10-pixel-tall characters, as seen
in 2018 Day 10, is coming soon.)

Put simply, it converts something like this to plain text:

```txt
 ██  ███   ██
█  █ █  █ █  █
█  █ ███  █
████ █  █ █
█  █ █  █ █  █
█  █ ███   ██
```

[![Downloads](https://pepy.tech/badge/advent-of-code-ocr)](https://pepy.tech/project/advent-of-code-ocr)
[![Supported Versions](https://img.shields.io/pypi/pyversions/advent-of-code-ocr.svg)](https://pypi.org/project/advent-of-code-ocr)
[![Testing](https://img.shields.io/github/workflow/status/bsoyka/advent-of-code-ocr/Test%20with%20pytest?label=tests)](https://github.com/bsoyka/advent-of-code-ocr/actions?query=workflow%3A%22Test+with+pytest%22)
[![License](https://img.shields.io/pypi/l/advent-of-code-ocr)](https://github.com/bsoyka/advent-of-code-ocr/blob/master/LICENSE)
[![Version](https://img.shields.io/pypi/v/advent-of-code-ocr?label=latest)](https://pypi.org/project/advent-of-code-ocr)

## Installation

Advent of Code OCR is available on PyPI:

```sh
$ pip install advent-of-code-ocr
```

Advent of Code OCR officially supports Python 3.7+.

## API Reference

By default, this module recognizes `#` as a filled pixel and `.` as an empty
pixel. However, you can change this using the `fill_pixel` and `empty_pixel`
keywork arguments respectively.

```py
from advent_of_code_ocr import convert_6

print(convert_6(".##.\n#..#\n#..#\n####\n#..#\n#..#"))
# A

print(convert_6(" $$ \n$  $\n$  $\n$$$$\n$  $\n$  $", fill_pixel="$", empty_pixel=" "))
# A
```

You can also convert data that you have in a NumPy array or a nested list:

```py
from advent_of_code_ocr import convert_array_6

array = [
    [0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0],
    [1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1],
    [1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0],
    [1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0],
    [1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1],
    [1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0],
]
print(convert_array_6(array, fill_pixel=1, empty_pixel=0))
# AOC
```

---

Advent of Code is a registered trademark of Eric K Wastl in the United States.
