Spike Prime - Tic Tac Toe - Fedor Agarshev

From RoboWiki
Jump to: navigation, search

Back to: List of projects of Spike up Prime Interest in Science and Technology through Games

About the project

The project is based on the game tic-tac-toe. The player plays against a robot. They take turns as in a regular game of tic-tac-toe. Instead of crosses and zeroes, Lego pieces in black and purple are used. The robot always moves in purple and the player in black. Who goes first is up to you. The robot will show its moves on the light matrix. The robot always tries to make the best move, as it calculates moves using the MiniMax algorithm.

Tic tac toe 0.png TicTacToe.png

Video

Build a robot

With this complex functional robot, you can play tic-tac-toe against the move calculation algorithm. But first it needs to be built.

  • Be careful while building the motors should be at zero. That is, the dot on the rotating part must match the circle on the base of the motor.

Building instructions:

Get the robot ready

Python code:

  • Connect the bottom platform to the motor behind the hub
  • Move the color sensor to the end. To move, rotate the motor holding the color sensor. After it has moved to the end, return it back a little so that it is in the center of the first cell.
  • Prepare chips for the game, you can use lego parts as in the video (but they may not be enough) or create your own, but be careful that the sensor sees them (if you want to use a different color, do not forget to change the color in the code).
  • Play with the robot. You can go first or second (Remember that you are playing as black and the robot is purple). Try to come up with a tactic.
  • Tic Tac Toe - Code V3

How to fool a robot

While playing with the robot, you could already understand that it does not check the correctness of the moves. Thus, nothing prevents you from placing a winning combination from the first move. Think of other ways to trick the robot.

Make the robot more careful

Now program the robot so that it controls all the possibilities of deception that you can think of.

Evaluate your performance

Think about what you did well and how you could improve for next time.


Teacher Resources