The goal of this project was to practice object-oriented programming (OOP) in Python, and designing a crossword puzzle was a neat way to create something fun and interactive at the same time. I used the Python library Pygame to render the graphics and handle keyboard events.
The overall structure of the program is straightforward: Tiles are a class with certain attributes (rectangles with a width and height, background color, display letter input by the user, actual letter, boolean to indicate whether the tile is active or not, and various other attributes…), and the Grid is a class created from a 2D-array of Tile objects, with specialized functions for recognizing/modifying other Tiles in the Grid as the game proceeds. The Clues class generates the text that is wrapped and placed around the Grid.
The following is a screen recording to demonstrate the appearance and functionality of the game (if anyone has managed to run/embed Pygame in a web browser, I would love to know how!)
To take a look at the code, check out the Github Respository