Alphabet Soup solver (Python): parser + 8 direction search, 0-based coords - per spec

Summary

This merge request adds my solution to the Alphabet Soup coding challenge in Python.
The program reads the puzzle input file, normalizes the words, and searches the grid in all 8 directions (forwards and backwards).
It prints each word with its start and end coordinates in the required WORD r1:c1 r2:c2 format, using zero-based indexing.


How to Run

From the project root: python -m venv .venv source .venv/bin/activate pip install -r requirements.txt python -m src.challenge.main --input alphasoup.txt

Make sure your puzzle input file (for example alphasoup.txt) is placed in the repo root, alongside the README.


Notes

  • Input files are assumed to be well-formed (per the challenge instructions).
  • Minimal validation is included: grid shape matches declared size, words list is non-empty.
  • Words with spaces are normalized by removing the spaces before searching (e.g. ICE CREAMICECREAM).
  • More details, examples, and test instructions are in the README.

Tests

You can run the unit tests with: pytest

Tests cover both parsing logic and the solver itself (horizontal, reverse, and diagonal cases).

Merge request reports

Loading