Joe 
 Binns 

email LinkedIn
GitHub YouTube itch.io
back

Wordle-like

About

An assignment based on Wordle, made for Futuregames' course "Data Structures and Algorithms".

Word Search

Searching through a list of 16,000 words every time I want to check if a word is valid or not is extremely inefficient. Since each words in the list is unique, I decided to instead use a hash set to store the words. Now, only a single hash function needs to be calculated to check whether a word is valid.

Text Editor

I decided to use Tilemaps to draw the guesses text. In order to uphold abstraction, I modified and stored the text through a custom text editor script. The text editor script stored the entire text in a single list. I then created convenient accessors, such as for fetching the word stored on the current line.

Grading Guesses

Applying the correct colouring to tiles was not as trivial as I initially expected. The solution I ended up with involved two passes. First, I determined colours based on the naive checks of "IsCharacterIncluded" (yellow) and "IsCharacterIncludedAtIndex" (green). For characters which were included in both the submitted guess and the solution, I determined the number of occurrences of each character. I then subtracted the number of occurrences in the solution from the number of occurrences in the guess, to get the excess number of occurrences of the character. On a final pass through the word, characters with naively yellow coloured tiles with excesses greater than zero were then uncoloured. I kept track of the number of occurrences of each character using a dictionary, allowing for O(1) lookup times.