Tic-Tac-Toe Playing Robot With Picaxe 08M

   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

Here is a link to the Youtube video . It used to be embedded in the page but it disappeared and I can't get the embed code to work .

http://www.youtube.com/watch?v=s0jUcuq0dXA

 

Plays Tic-Tac-Toe

  • Actuators / output devices: Servos
  • CPU: picaxe 08M
  • Power source: 5V bench supply
  • Programming language: Picaxe basic
  • Sensors / input devices: switches
  • Target environment: desktop

This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/tic-tac-toe-playing-robot-with-picaxe-08m

Oh, this is a good one

Very nice --and on a 08m as well!

If nothing else, there are so many usable “chunks” you have here --Game code, good simple mechanics, mulitple inputs (game board contacts) etc. I will be stealing ideas for sure --I think Walter may have to add tic-tac-toe to his games!

 

Hey, you seem to have a game

Hey, you seem to have a game playing robot theme going here. Your last bot was a particular favorite of mine, playing ‘Towers of Hanoi’. Keep up the great work!

You may have to rename

You may have to rename Walter to WOPR :slight_smile:

Bravo!

Bravo!

Thanks . Actually , one of

Thanks . Actually , one of the first computer programs I wrote was a tic-tac-toe game for a C64 . It worked but could be beaten so I was trying to improve on my previous efforts . The “Towers of Hanoi” was also from the C64 days . So I guess the theme is “stuff I did on a c64”  :slight_smile:

nice

Nice job …I’m enjoy the video ^^

lol what a strange game, the

lol what a strange game, the only winning move is not to play :stuck_out_tongue:

(sry, couldn’t resist)

WOPR…

I dunno if you knew this or not, but that is the audio clip I use to introduce Walter’s “game mode”…

https://www.robotshop.com/letsmakerobots/node/25793  --good part starts at around 2:00 or so…

I’ve watched that video

I’ve watched that video before but I forgot about that sound clip . Walter is an incredible robot .

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 :slight_smile:

lol i hadn’t seen that yet.

lol i hadn’t seen that yet. nice :smiley:

may i suggest for a possible future project:
http://www.portal2sounds.com/

:smiley:

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.

groovy setup! so if you

groovy setup! so if you build another one to go second it will always result in a cats game

Ooh, ED!

Thank you for posting the electrical diagram!