You are on page 1of 4

We can model the game tic tac toe using what is called a game tree:

Above is a section of a game tree for tic tac toe. Each node represents a board position, and the children of each node are the legal moves from that position. To score each position, we will give each position which is favorable for player 1 a positive number (the more positive, the more favorable). Similarly, we will give each position which is favorable for player 2 a negative number (the more negative, the more favorable). In our tic tac toe example, player 1 is 'X', player 2 is 'O', and the only three scores we will have are +1 for a win by 'X', -1 for a win by 'O', and 0 for a draw. Note here that the blue scores are the only ones that can be computed by looking at the current position

----------------------------------------------------------------------------------------------------------------------------------------

A SIMPLE TIC TAC TOE GAME IN C LANGUAGE


Introduction
The Game is a simple classic tic tac toe game between two players using the keyboard. It involves Game Theory Prediction and Algorithms. Using these, we will be able to write a valid c source code to implement the game. In game theory, a game tree is a directed graph whose nodes are positions in a game and whose edges are moves. The complete game tree for a game is the game tree starting at the initial position and containing all possible moves from each position; the complete tree is the same tree as that obtained from the extensive-form game representation. The diagram shows the first two levels, or plies, in the game tree for tic-tac-toe. We consider all the rotations and reflections of positions as being equivalent, so the first player has three choices of move: in the center, at the edge, or in the corner. The second player has two choices for the reply if the first player played in the center, otherwise five choices. And so on. The number of leaf nodes in the complete game tree is the number of possible different ways the game can be played. For example, the game tree for tic-tac-toe has 26,830 leaf nodes.

Minimum Requirements
Software requirements : Operating System : Windows 98/XP/Seven(32-bit) Language: C/C++ Compiler: Turbo C 3.0, DosBox Hardware requirements : Processor : Intel Pentium III or above Ram : 256 Mb (min) HardDisk : 1 GB Monitor: VGA enabled standard Monitor

Keyboard: 101- Standard Keyboard

Objective
The objective is to WIN the game by putting identical marks on a straight line. 3X3 grid is considered here and a straight line of the same element has to be formed.

Implementation
This game has 3X3 grid which gives out 9 positions and they can be filled by X or O which represents the mark of each player. The aim is to fill all the three blocks of straight lines either with Xs or Os. The player (or the computer) who fills the marks in a straight line wins the game.

Scenarios
A player should place his or her mark to be in one of the three situations : WIN :Look for a row, column, or diagonal that has two of the players marks (X or O, depending on which player) and one empty cell. If one exists, place my mark in the empty cell. The player wins! BLOCK :Else look for a row, column or a diagonal that has two of my opponents marks and one empty cell. If one exists place the players mark should be placed in the empty cell to block a potential win by the opponent. TIE :This is a state where neither the player nor the computer wins the game. There will be no more chance to win.

Conclusion
Games like tic tac toe follows two properties:

Two player - we do not deal with coalitions, etc. Zero sum - one player's win is the other's loss; there are no cooperative victories.

You might also like