Tic-Tac-Toe Playing Robot With Picaxe 08M
| Attachment | Size |
|---|---|
| tic_tac4c.bas | 4.2 KB |
| serial_tic_tac3c.bas | 2.7 KB |
| tictacschm.png | 19.62 KB |
| ticswitches.png | 5.26 KB |
This is my Tic-Tac-Toe playing robot controlled by a Picaxe 08M . It plays a perfect game as long as it goes first and it always goes first . It is a work in progress so it doesn't look very good right now . It uses plastic beads as the machines play pieces . It will use steel ball bearings as the human play pieces, but I don't have any right now so I'm using some fishing sinkers .

The algorithm for playing came from an article in the December 1971 issue of Radio Electronics called Tic-Tac-Tronix by Don Lancaster . The flow chart at the top of the article is what I implemented in Picaxe code using lookup tables . It plays by always going first and playing the same corner square . It always wins or ties .
The robot consists of servos that rotate the arm and position a slide that holds the board . The third servo operates the gripper . The servos are old and slow which may be a good thing . The servo that moves the sled with the board is a Royal Titan from the mid 80s which was the original cheap servo at $19.95 . It still had the EK Logictrol connector on it .

The play board consist of 9 switches made from brass stock in a V shaped trough . The humans conductive play piece , in this case a ball bearing or fishing sinker , bridges the gap and closes the connection . The Picaxe reads the switches state by using a CMOS 4017 decade counter . Only one output of the 4017 is high at a time . The Picaxe pulses the clock line 9 times to cycle through the switches and a tenth time to set it back to the start position with output 0 high . Each output is run through a 1n914 diode so the high output and low outputs of the 4017 aren't connected through the common of the switches . If the switch is made and its output from the 4017 is high the high shows up on the pin3 input of the Picaxe . Pin3 has a 10K pulldown resistor . I chose this method because I needed to read 9 switches and only had 2 I/O pins left . It may not be the best way but it seems to work .


The program uses 253 of the 08m's 256 bytes and all the I/O pins so the operation is pretty basic . To signal the game is over , instead of a win light the gripper is closed in the home position instead of being left open . You have to look at the board to decide if you lost or tied . I see the 08m is being replaced by the 08m2 with a lot more memory and another I/O pin so I may continue the project with an 08m2 . It should be possible to let either player go first and have a lot more features .
I started building this because I wanted to see if it was possible to do with an 08m . After finding the Tic-Tac-Tronix article , I thought it might be possible , but I still had to do several rewrites to get it to fit . If you want to see the game logic without the robot , I have included a serial version of the program that runs in the simulator . I have also include the schematic that I drew after I built so I hope it's right .
Here is a link to the 1971 Radio Electronics article . It's very interesting . It's about halfway down the page .
http://www.tinaja.com/glair01.asp



@ Tue, 2011-08-30 08:06
Ooh, ED!
Thank you for posting the electrical diagram!
@ Thu, 2011-07-07 08:12
groovy setup! so if you
groovy setup! so if you build another one to go second it will always result in a cats game
@ Thu, 2011-07-07 07:04
This is a nice robot!
This is a nice robot! Instead of the 4017 I would use a resistor array, then you only need one adc input.
@ Wed, 2011-07-06 19:05
Wow I love your setup, great
Wow I love your setup, great robot. I used to play with C64 too,it was amazing at that period of time. Thanks for sharing :)
@ Wed, 2011-07-06 18:08
WOPR...
I dunno if you knew this or not, but that is the audio clip I use to introduce Walter's "game mode"...
http://letsmakerobots.com/node/25793 --good part starts at around 2:00 or so...
@ Wed, 2011-07-06 19:06
lol i hadn't seen that yet.
lol i hadn't seen that yet. nice :D
may i suggest for a possible future project:
http://www.portal2sounds.com/
:D
@ Wed, 2011-07-06 18:31
I've watched that video
I've watched that video before but I forgot about that sound clip . Walter is an incredible robot .
@ Wed, 2011-07-06 18:01
lol what a strange game, the
lol what a strange game, the only winning move is not to play :P
(sry, couldn't resist)
@ Wed, 2011-07-06 17:40
nice
Nice job .....I'm enjoy the video ^^
@ Wed, 2011-07-06 17:21
Bravo!
Bravo!