Friday, April 10, 2020

How to Never Lose at Tic Tac Toe


Let’s have some basic definitions here.

Counter - Making a move that blocks your opponent
Centre - The square in the middle surrounded by all the other squares.
Edge - A piece in row or column with the centre.
Corner - A piece in diagonal with the centre.


When playing first

Don’t place your first move on an edge.


1) Centre

If you mark the centre, your opponent will either place the first piece on an edge or corner piece.
·        If they mark an edge, place your next piece on one of the two corners furthest from the edge piece. If they block that move, place your on corner in the same row.  Now you have two ways to win. If they don’t block it, you will win by placing your move on the edge.
·        If they mark a corner, opposite corner, or the corner that would make a diagonal of two X's and one O. If they place their next piece on an edge, you now have two ways of winning, depending on which edge they placed their O on. Otherwise, assuming you keep counter-attacking, the game will be a draw.


2) Corner


·        If their first move is not the centre, your next move should be in the other corner of the same row you placed your first piece. If they block you will have two ways to win.



·        If their first move is in the centre, it's a little bit trickier. Again, form a diagonal. If their next move is in the corner, you can trap them by placing your next piece at the intersection of the row and column of the previous two X's. If their next move is at an edge, you'll be forced to settle for a draw.


Playing second.



Depending on where your opponent plays the first piece, these are some ways to defend.

1) Centre

If he chooses the centre, place your O on the corner immediately, which will buy you some time. According to the best strategy, your opponent will place his next X on the opposite corner to yours. Your next piece should not be bordering your previous move. Then, it's the simple matter of continuously blocking and counter-attacking until a tie is reached.
2) Corner

If they mark a corner, mark the centre, or you will almost certainly lose against a good opponent. Then remember that there is one outcome in which a tie is possible from above.

Your opponent has two choices, to either form a diagonal or place their next piece somewhere else. Assuming that their move forms a diagonal, as the strategy would dictate, stay on the edges and off the corn
ers. You can force a tie this way.





Contributor:-

Gaurav Waghmare


9 comments:

Documentation

Course Project Title: TIC-TAC-TOE GAME in C++ Description: Tic-Tac-Toe is a zero-sum and perfect information game. As the total perm...