Optimization of word lookup
It would be nice if the player of our Wordle game didnāt need to wait for the entire dictionary file to be read into memory given that itās looking for only a few words. The dictionary file is sorted and each word is 5 letters long, so we should be able to check for the presence of a word using a binary search algorithm which has been modified to seek through the file.
Validation with HTTP requests
For word validation, a simple file lookup is a great start, but this file doesnāt contain support for valid words that are plural or past-tense. A variety of free APIās exist for simple word validation. Take a look at this one from Dictionary Api. Then use the http client hosted on Unison Share to incorporate more robust guess validation.
Constructing a custom ability
Rewrite the game loop as a Console ability, the ability should be able to get user input, and write text out. A simple handler might interpret the Console ability into IO, and a more complicated console loop handler might conditionally run an interaction using the Console ability until a given predicate returns false. Check out the example ability handlers here
Other command line games
The fundamental interactions for this command-line game are shared with a variety of other games like Battleship, Connect4, etc. If you write one, post it!