## Introduction: Matchbox Mini Chess Learning Machine

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)

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.