Tuesday, June 19, 2012

Okay, so maybe it isn't as complicated as this little machine... by a long shot... BUT using some of the same principals to develop the combinations needed from scratch.

Here is a link to the diagram I used to start writing the formula to go level by level calculating the potential 'touches' that a word could have.

For example, if the word I wanted to build started at position 5, the next possible position would be either a 6, 10, 9, 1, or a 2 (see prior post for the actual positions). Number 6 would be due east, 10 southeast and so on and so forth. I need to know this as we progress down the levels so I can follow the rules of Wordament - once I 'touch' the number 7, I can no longer touch it until I pick up my finger (z axis).

The diagram also tells me the number possible 1st choices I have for the formula - so the most being 6,7,10,11 - as they are in the middle of the board and the fewest being 1,4,13 & 16 since those areas are in the corners. Each combination of these gives me every potential position for 2 letter words. I'm sure there is a mathematical formula to prove the number I have (or prove that it is wrong) - closest I could get using the combination formula: however, this does not take into account the rules of not using a number again.

Nevertheless this get's me exactly 84 combinations for level 1 and level 2... now for the fun part.

Sunday, June 3, 2012

Before the Machine there was...

Before there was ever a machine that would except the code that I sent it there had to be some mechanism to actual compute the possible paths that could combine the letters to make words.

Lucky for me there are multiple sources for databases of potential 3, 4, 5 & 6 letter words thanks to the community that is obsessed with Scrabble . Once I had a comprehensive list it was a matter of building a spreadsheet in MS Excel that could do two things. The first, as I mentioned, would be to calculate all the potential paths according to the rules of Wordament - basically that the letters had to touch each other and you could not reverse. This was where I eventually started: labeling the 'cells' and writing an formula (for another post) that could figure this out for me.
I'm no mathematics expert, so I'm sure I took the long road, but once I had the concept down, it all when pretty fast and now I have data for up to 7 letter words, which, for the way my excel model is set-up, is pretty much the limit (even for a 4 core Intel i5 processor) I could match during the 2 minute Wordament game window.

So, just real quick - to the right are the potential combination from position 1 - 11 in total. All said an done, for each position, there comes out to be around 400 (408 to be exact) potential paths to create a 3 letter word, starting from each position. Again, I'm sure there is a formula out there to compute the potential outcomes, but I needed to know EVERY outcome.

The second step was to match the potential paths to the actual words during each round. This is essentially just a big VLOOKUP that makes its way into a PivotTable to weed out the blank values and sort by a theoretical total point value.

I'll be going into each of these steps in much greater detail, but I wanted to layout the big concept of the calculation that eventually is turned into GCODE for the CNC GRBL shield to recognize. It is great fun - hope you'll join me as I document my process.