/tic_tac_toe.c

Tic Tac toe is a game in which two players seek in alternate turns to complete a row, a column, or a diagonal with either three O's or three X's drawn in the spaces of a grid of nine squares; noughts and crosses.

Primary LanguageC

Here is code for the game Tic Tac Toe in C programming language. This game can be played between two palyers.

Tic Tac Toe is a two-person game , played on a 3 X 3 cell grid.

[ ][ ][ ]

[ ][ ][ ]

[ ][ ][ ]

Players usually draw 3 X 3 grid on a piece of paper (though there are plastic, cardboard, and computer versions), using a pound-sign(#) to represent the grid: Each player takes a turn filling in a cell of the grid, either writing an X or an O in it. One player always writes Xes. The other always writes Os. Each player tries to place three X'es or three O's (whichever is his symbol) in a horizontal, vertical, or diagonal row and also tries to block the other player from doing so. The player who first fills in a row, wins.

Traditionally, the winning player draws a line through the three cells that earned him the win.

Most games between competent players end in draws, with all cells filled and neither player winning.