This matchbox computer is one of the simplest machine learning projects that you could make. All it takes is the following:

- a piece of cardboard divided into 9 squares
- 3 white pawns
- 3 black pawns
- 24 matchboxes
- a paper printout (provided)
- beads (blue, orange, green, yellow)

Note from Erik's dad:

I built this machine when I was a kid. Thanks to Martin Gardner's books and my dad, I learned a lot of math puzzles and games. This machine was described in one of those books. I decided to rebuild it with my son now. I hope he will do the same with his children too :-). The machine and the game are described in this article: http://www.cs.williams.edu/~freund/cs136-073/GardnerHexapawn.pdf . I learned recently that some people build even bigger machines. For example, the one which plays tic-tac-toe requires 304(!) matchboxes. Who knows, maybe one day...

## Step 1: How to Build

What you will first need to do is empty all of the matchboxes (preferably into a sealed box for safety purposes) and print, cut out, and paste each rectangle (representing the different possible playing positions) onto the front of each matchbox (pdf files included, and OpenOffice files for people who want to edit it). After you have done that, you will need to put a bead for each arrow drawn on the rectangle (a blue arrow would be a blue bead in the box, etc.). After you have set that up, you are ready to play.

## Step 2: How to Play

To play, you set up all of the white pawns on one side of the board, and all of the black pawns on the other. You will be playing as white. You make a move, which can be going forward (with any pawn) by one square. After that, you will find the box which resembles the current board position. When you do, you will shake the box, and without looking, pick a random bead from the box and put it back. Whatever color bead it is represents the color arrow the machine's move will be (picking an orange bead will result in you making the machine's move with the corresponding color arrow, which would be orange). After that, you will make your next move. You can either move forward, or you can kill a pawn (if there is an enemy pawn diagonal from you, you can move onto it's square and eliminate it). You chose the box that represents the current situation again, and blindly pick another bead and make the machine's move based on the color bead. Continue this until one player has either made the opponent unable to make any move, eliminated all of the pawns, or gotten one pawn to the other side of the board.

## Step 3: How to Teach

If the machine loses, "punish" it by taking out the bead from the box that decided it's last move. If there is only one bead left in that box, remove the bead that decided the previous move from the previous box. If you lose, move on to the next match. Repeat this multiple times. This process simply teaches the machine what moves caused it to lose, and eliminates those moves, leaving only winning moves. After about 10-15 losses, the machine becomes almost unbeatable.

<p>I don't have a good source for matchboxes in that quantity so I went to the craft store and got a bunch of tiny ziplock bags. I slipped the pictures inside with the beads. </p>
<p>Ok, I just printed everything. I am curious about why there are numbers on each of the box covers (2, 4, or 6)</p><p>I would love to get my hands on that tic-tac-toe game. I have a few students that are fascinated by this whole idea. They want me to make it yesterday. For a group that complains about doing math, they do seem to love the challenges.</p>
<p>Hi! The numbers on the box covers are the move numbers, so you would make the move, and the machine makes the second move (labeled with a 2) and you would make the third move, and the machine will make the fourth move (labeled with a 4)</p><p>By the way, this is not tic-tac-toe, because tic-tac-toe would require many more boxes (304), but this is a mini-chess game, so it only requires 24 matchboxes.</p><p>PS: I think your students will like it!</p>
<p>That is what I thought the numbers were. I just wanted to be sure. I almost have the 24 boxes done.</p><p>I am working on thematic tac toe moves separately. I think I have the first 3 machine drawn out--moves 2, 4, and 6. I spent last evening removing duplicates (rotations and reflections). I was hoping for a way to double check my work before I make it and screw it up. I guess I will just have to see if I end up with exactly 304. How certain are you that this is the exact number?</p>
<p>You can take a look at this article--it describes the tic-tac-toe machine in great detail: <a href="http://shorttermmemoryloss.com/menace/" rel="nofollow">http://shorttermmemoryloss.com/menace/</a><br>Or just google 'tic tac toe matchbox machine' or 'menace'</p>
<p>I read the article. It was great. I understand a lot more now--even the name MENACE. I love the game GO but haven't played it in years. I will have to get it back out. It might be time to re-learn it. Thanks again for all the great new things to ponder.</p>
<p>I tried Google without much success. Thanks for the link.</p>
<p>Donald Michie, a British mathematician wrote about this type (matchbox) learning and it was published in the early 1960s. The great Mathematical Games author from Scientific American, Martin Gardner, wrote about it in 1962 (</p><p>http://cs.williams.edu/~freund/cs136-073/GardnerHexapawn.pdf.) He then went on to describe this Hexapawn game. You did a great job of describing this and making an old game into something modern readers may enjoy.</p>
<p>Thanks for you kind words! Yes, that's precisely the article we (Erik and me, his dad) used as a guidance to build the machine. I found descriptions of other similar machines, e.g. to play tic-tac-toe, but that one requires 304 matchboxes! Next time... :-)</p>
<p>Very interesting, I've not seen this before. Thanks for sharing!</p>
<p>I hate chess--takes too long, is slow, and hard to find a partner to play with--at least one that I want to spend that much time with. This looks like fun. I may have some suitable matchbox substitutes in my basement. Thanks for the project and the game to add to my collection.</p>
<p>Interesting. I have never seen a mini chess set like this before. I am going to have to try it.</p>