Sunday, November 4, 2012

The Fun Part

Been a while, but unfortunately  building Wordament playing robots is not my full time job... unlike some people...

So, the goal now is the match as many 3+ letter words as possible in a 2 minute window.  Of course, the more letters the word has, the better the chance that you'll get some good points out of it - similar to Scrabble.  Obviously 2 levels of touches won't get us many words, but as we progress, the combinations get exponentially greater.   Level 2 - 84 touches, Level 3 - 408 touches, 4 letter words - 1,764.  Even Excel, backed by an i5 has a hard time now matching up 6,714 rows against a 5 letter dictionary base of almost 9,000 5 letter words.  That is a lot of number crunching!

Using my master 'possible touches' map I came up with a simple (to start with) formula in excel to try to find the next title in the series:


Let me break that down a bit.

In this case cell 'N3' would be the last title that I was sitting on and the array 'B4:J19' would be the possible touches map.  Now, lookup the last title I was on to get the next possible value.  'O1' would be a dynamic indicator of which column of the possible touches array that I was trying to lookup on.  In this case, directly East which would be title number 3, however, this is checking for a zero, in which case, it returns a blank.  The next vlookup checks to see if a title has already been used, if so, returns a blank, then the final vlookup actually returns tile 3.

This is the basis for determining all the potential values - once you have a completed set for a number of letters, those become the paths to the next letter, in which the formula above is applied adding and extra check to make sure that you don't pull in tiles that have already been used.

Possible 7 letter words:


Looks like a mess when it is pasted down here, but the only difference is the check to make sure nothing is being used twice.

Once I have all those values, I concatenate the results and boom - I have my pathways.

On to dictionary matching techniques!  Then GCode production similar to those AMAZING CNC milling machines and 3D printers!  Stay tuned!!

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.

Sunday, May 27, 2012

Which motor?

Starting this project out I thought I a lot about the types of motors that would work the best. I obviously needed a motor that could be controlled precisely, but also offered speed and torque enough to move two independent platforms for the x & y axis. Since I'm not an engineer and this was really my first stab at any time of motor control I had to do some extensive research.

Thought about using the tons of DC motors I had laying around, but after a few in-depth Bing searches, stumbled upon this tutorial by Tom McWire over at Instructables. Wow. I had originally planned on keeping the X & Y axis on 1 plane, however, after seeing how Tom tackled the process, I knew this was the direction I was heading. This design wasn't new to anyone who had dealt with CNC milling before - but it was new to me.

Knowing I had to dig up some steppers, I immediately hit up our community garage sale to see what I could scrounge up in the way of flat bed scanners or old printers. A few hours, a funny look from my wife and $20 later, I had 2 inkjet printers yielding 2 usable steppers and 2 all-in-one yielding 4 good steppers to start playing with. The key to this story is that with one of the all-in-one printers that I picked up, they guy gave me a DVD player that I was going to throw into my recent HTPC build - well, dumb me, the DVD drive was IDE and not SATA so it was useless. I was in the mood for taking things apart to salvage, so I thought I would go ahead an dismantle this while I was pulling apart the printers. To my surprise, there was a little stepper motor driving the laser on a set of rails that were practically already built for moving is a straight, square line. Perfect. From that point on I build the Word.A.Bot with that in mind... bummer since I just bought a bunch of printers (still have many plans for the bigger steppers, and the GRBL shield is perfect for most sizes), but a quick trip to Goodwill and I had 3 DVD drives complete with everything I needed to get my project rolling... now how was I going to mount it all together. Easy. With man Legos - aka, PVC pipe.

Sunday, May 6, 2012

Getting Started - Why?

Over the next few months I'll be detailing out the process of creating the Word-A-Bot.  From start to finish - research, building, inspirations and tweaking.

But after all this is said, the one question still remains - WHY?

Why would I take the time (in a very busy schedule) to build this machine that really has one and only goal - to play a game and at this point-in-time, a game on a platform that isn't extremely popular (WP7).

Let me just say flat out, that I had my Samsung Focus on launch day - called the store (they weren't having any problems keeping them in stock) and picked it up on the way home from work.  First smart phone purchase.

Around 1.5 years later I was sitting in a lecture from a MS employee at a tech. conference and he mentioned it, so I thought I would give it a try.  Turns out - it is a lot of fun.  On your own, with a team (my wife loves it) or when you only have a few minutes to spare.  Problem is... I'm not the best as spelling... I am, however, good at building Excel models and thought I would try my hand at robotics.  The result - a Wordament playing robot...

So, why?  Because I did.  For fun, something new to learn and to keep the creativity and problem solving juices flowing.  More details to come...

First video: