This “bot” (currently more of a calculator) was created to play the game “Keyword” at King.com. The game board is a 5 x 5 grid of letter tiles, the aim in each round is to create the 3 highest scoring words by linking adjacent (horizontal, vertical and diagonal) tiles. Tiles can not be reused.
The main challenges are primarily creating the highest scoring word, but also thoughtfully selecting tiles so as to not block potential 2nd and 3rd words. E.g. it may be more beneficial to play 3 words with mid-range scores, than 1 high scoring word that blocks tiles leaving only low scoring words for the last 2.
For my implementation, I created a WinForms application in C#. The algorithm isn’t too intensive so the overheads of the .Net framework and memory management are acceptable. C# simplifies the coding and WinForms allows quick creation of a GUI. A large dictionary of words stored in a text file is parsed in to a data structure called a Directed Acyclic Word Graph. A DAWG allows quick searching of thousands of potential words. My word list currently contains over 178000 words and a list of every single combination of tiles that produces a valid word in produced in the blink of an eye.
-Calculating optimum selection for all 3 words.
-Automatic reading in of the game board.
To be continued…