This Robot Can Automatically Play Wordblitz on a Phone
Rather than painstakingly searching for every single word in a four-by-four grid, this plotter will do it for you at lightning speed.
What is Wordblitz?
Boggle is a word game released in 1972 by Parker Brothers, and it involves jumbling a set of sixteen dice and getting them to land in a four-by-four grid. The goal is to compete against one other opponent by finding as many words as possible within a short amount of time in order to win. This is done by finding adjacent letters, which form words at least three letters long while only using a die at most once per word. Wodblitz is simply a mobile app of Boggle that emulates this behavior, where a player must swipe from letter to letter and form as many words as they can.
Due to the difficulty and limited time component, GitHub user GhettoBastler (meaning "jury-rigged DIY" when translated from German) wanted to build an automated system that could quickly and accurately solve these puzzles.
Building the plotter
The main structure of the robot is based around a plotter that uses two linear axes to move a toolhead, similar to a CNC mill. Each of the stepper motors were wired to a single Arduino Uno that acted as a controller by running a modified version of GRBL. Because phone screens rely on changes in capacitance to register touches, the toolhead consists of a foil-wrapped cotton swab that is electrically connected to the sheet metal plate underneath the plotter's base. This essentially turns the machine's central area into a giant capacitor, which the phone's touchscreen controller can sense.
Extracting letters
One important goal was to ensue the phone could be accurately touched no matter how it was positioned within the plotter. Bastler's program utilizes OpenCV and a series of 19 ArUco makers that allow the Raspberry Pi to recognize the exact skewing of the region and generate a translation matrix in response. After correcting for the camera's angle, the grid displayed on the phone can be recognized via OCR and sent for solving.
The solving algorithm
Before this machine was even conceptualized, Bastler had written a simple Python script he calls Boggle Bot. The program starts by asking the user for a list of 16 letters that have appeared on the grid. From here, it searches all neighbors of each grid square for potentially valid words and compares the found result to a pre-made list. Once all possible combinations have been found, a list of paths is generated and displayed in the command line. With this script in hand, Bastler could slightly adapt it for use in his now-automated system.
Playing the game
After launching the game on his phone and placing it onto the plotter, he ran the program and watched as the Raspberry Pi spat out GCODE for the plotter to follow. Although the machine works quite well at the moment, it does have a few limitations. Namely, cells worth multiple points aren't recognized, letter recognition can fail, and optimal paths are not generated to reduce pen-lifting movements. But even so, Bastler was still impressed with the result he achieved. You can read more about this Wordblitz solving robot here in its GitHub repository.