

From my tests, I was unable to properly detect the letters P, I and R, so some hardcoded correction was needed.The tile grid is then 'chopped up' to obtain the 16 tiles, then some image pre-processing is applied before attempting OCR.From there a snapshot is taken of the tile grid (pixel coordinates are coded for 1920 by 1080 screen resolution).For convenience, I used pyautogui to search for the hint button as a way to detect if the Wordament game is on-screen.Used the pyautogui library to take screenshots, cv2 and numpy to assist with image processing, and pytessaract for OCR.Finally, output the words found to the terminalĪfter I got the above working, I proceeded to code in some OCR to detect the tile grid automatically:.prefix tiles can only be pathed from but cannot be pathed to, either/or tiles will require two runs, etc) Run the pathing based on user's selection, taking note of special tiles (e.g.Seek user input on whether user wants to search for words using special tiles only, or search for words of specific length, or search for all words.Detect the presence of special tiles (prefix, suffix, either/or, digram, corners).Get user to manually input the letters left to right, top row to bottom row, in space delimited manner.Define a bunch of functions to help with pathing (given any starting point in the grid, go left/right/up/down/etc to as yet unused tiles to form letter sequences and test if they might be valid words).say the code finds a path with letters in the sequence 'XYZ', there is no point pathing further since there are no words that start with 'XYZ') Prep a set of 'valid' truncated words from the word list (this is used later to decide to stop 'pathing', e.g.Read in a word list (I tried various dictionaries found online and ultimately settled on using a Scrabble word list).

The following ideas and approaches were adopted:. My code is designed to work in single-player, and the motivation for this (in addition to the joy of learning to code) is to find those last few pesky 'common words' that Wordament says that I have yet to find. This is a coding project that I was most happy with - building a solver that could search for possible words in the Microsoft Wordament game.ĭisclaimer: Of course, do not use such code to cheat in multi-player.
