For 1-Person game (User vs. CPU), please refer Implementation of Tic-Tac-Toe game
Rules of the Game
- The game is to be played between two people (in this program between HUMAN to HUMAN).
- First the game will take the names of the two players as input.
- One of the player chooses ‘O’ and the other ‘X’ to mark their respective cells.
- There would be a game toss, which will decide which player will move first.
- 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 the game is Tie then, A message is displayed “Game is Tie”.
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 way – “ Two expert players will always draw ”.
Isn’t this interesting ?
Below is the code for the Game:
Below is the output of the above code:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Game Theory (Normal - form game) | Set 1 (Introduction)
- Implementation of Minesweeper Game
- Project Idea | Searching a person in stored video sequence
- Lucky alive person in a circle | Set - 2
- Count of ways to distribute N items among 3 people with one person receiving maximum
- Project Idea | (A Game of Anagrams )
- A Number Link Game
- Hangman Game in Python
- OpenGL program for Simple Ball Game
- Project Idea | Breakout game in Python
- Design a Chess Game
- Color game using Tkinter in Python
- Python | Catching the ball game
- Number of wins for each player in a series of Rock-Paper-Scissor game
- Predict the winner in Coin Game
- Minimum possible final health of the last monster in a game
- Expectimax Algorithm in Game Theory
- Number Guessing Game in Python using Binary Search
- Building and visualizing Sudoku Game Using Pygame
- Largest odd divisor Game to check which player wins
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.