#028 - Boggling the Mind #100DaysOfCode
As my coding is formally limited to the weekends until September, I decided to spend the weekend exploring the word game Boggle for my next coding project.
Somewhere inside our TARDIS that is the attic, we have a classic rendition of Boggle, produced and distributed by the Parker Brothers. I considered buying the new Boggle (manufactured by Hasbro) with the view of studying the dice set and understanding the game logic. I believe this all started since playing 'Wordament' from the Microsoft Ultimate Word Games suite on my Windows 10 computer.
I held off buying the new Boggle and found a few useful sources on the Interweb. I came across two Boggle collections of 16 dice featuring all the lettered facing from each die - with one set dubbed 'Classic', while the other set is categorised as 'New'. I also stumbled upon the Collins Scrabble Words (formerly SOWPODS) word list that features 267,753 words. It is not the latest revision, which is seemingly in the region of 279,496 words (CSW19).
One of the tricky tasks will be interacting with the DOM (Document Object Model) minus the click-and-drag functionality that is more accessible than multiple clicks on each die face when composing words. I could allow the user to type out the words they see on the screen. Who knows? Firstly, I want to simplify the game logic, especially when calculating the dictionary validation of each composed word in real-time.
At the time of writing, I have an active grid of 16 cubes. Each die generates a unique face from the 16 dice collection. I am happy with the working results. I even managed to recycle a key function from my quiz project. Fortunately, I only made two small tweaks, which essentially allows the player to randomise the facing of a 6-sided die - to simulate the rolling of a die in a game of Boggle. With 16 randomly generated results across a grid of 16-facing cubes, my browser is fast to calculate this process instantaneously at every webpage refresh.
I am waiting for the new edition of the Collins Scrabble Dictionary to be published next month, so I can better understand the definition of these random words. Plus, it would be nice to expand my vocabulary - should I choose to play a competitive game of Scrabble, or when expressing myself in an inquisitive conversation.