| Description | Alice and Bob want to play Tic-tac-toe. This is a game where two players, X and O, take turns marking the spaces in a 3x3 grid. The player who succeeds in placing three respective marks in a horizontal, vertical, or diagonal row wins the game.
You are asked to write a program to simulate the game. Name the 9 grids with number 1, 2, 3, ..., 9 as below:
1 2 3
4 5 6
7 8 9
Two players will enter the grid number just as marking the spaces during the game.
After each game, you are asked to tell which player wins or it is a draw.
|
Facebook