Skip to content

This program is a small game Tic Tac Toe in C programming, here two users can play this game and after completing the game program will show the winner user name. This program is created using by Two Dimensional Array.

Notifications You must be signed in to change notification settings

ashish3281/Tic-Tac-Toe-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

Tic-Tac-Toe-Game

Rules of the Game


The game is to be played between two people (in this program between HUMAN and COMPUTER).


One of the player chooses ‘O’ and the other ‘X’ to mark their respective cells.
The game starts with one of the players and the game ends when one of the players has one whole row/ column/ diagonal filled with his/her respective character (‘O’ or ‘X’).
If no one wins, then the game is said to be draw.


Implementation

In our program the moves taken by the computer and the human are chosen randomly. We use rand() function for this.


What more can be done in the program?
The program is in not played optimally by both sides because the moves are chosen randomly. The program can be easily modified so that both players play optimally (which will fall under the category of Artificial Intelligence). Also the program can be modified such that the user himself gives the input (using scanf() or cin). The above changes are left as an exercise to the readers.


Winning Strategy – An Interesting Fact

If both the players play optimally then it is destined that you will never lose (“although the match can still be drawn”). It doesn’t matter whether you play first or second.In another ways – “ Two expert players will always draw ”.****


OUTPUT


Screenshot (269)

Screenshot (270)

Screenshot (271)

Screenshot (273)

Screenshot (274)

About

This program is a small game Tic Tac Toe in C programming, here two users can play this game and after completing the game program will show the winner user name. This program is created using by Two Dimensional Array.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages