Skip to content

Tic-Tac-Toe is a classic two-player game where players take turns placing their icons (X or O) on a 3x3 grid. The goal is to get three of your icons in a row before your opponent. It has been enjoyed by all ages for many years

License

Notifications You must be signed in to change notification settings

sir-siren/tic-tac-toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Tic-Tac-Toe

Tic-Tac-Toe is a game that has been enjoyed by people of all ages for many years. It is a classic two-player game in which each player takes turns placing their icons (either an "X" or an "O") on a 3x3 grid. The goal of the game is to get three of your icons in a row (horizontally, vertically, or diagonally) before your opponent does.

In this version of Tic-Tac-Toe, you have the option to play against the computer. To play, simply choose a space on the board to place your icon. The computer will then take its turn, placing its own icon on the board. The game will continue in this manner until one of the players wins or the game is a draw.

Tic-Tac-Toe is a simple game that is easy to learn, yet it can be highly addictive. It is a great way to pass the time and have some fun with friends and family. Whether you are a seasoned veteran or a newcomer to the game, Tic-Tac-Toe is sure to provide hours of entertainment. So why wait? Give it a try and see if you can outsmart the computer!

To play the game, you will need to have Python installed on your computer. If you do not have Python installed, you can download it from the official Python website: Python.

tic-tac-toe

How to Play:

  1. Open a terminal or command prompt and navigate to the directory where you have saved the tic-tac-toe game file.
  2. Run the game using the command python main.py
  3. The game board is a 3x3 grid, with nine spaces in total. The goal of the game is to get three of your icons in a row (horizontally, vertically, or diagonally) before the computer does.
  4. At the start of each turn, you will be prompted to choose a space to place your icon. Simply enter the number of the space you want to place your icon in (1-9) and press Enter. The computer will then take its turn.
  5. The game will continue until one of the players wins or the game is a draw. If you win, the game will end and you will be declared the winner. If the game is a draw, the game will end and it will be declared a tie.

Rules:

  1. Player and computer take turns placing their icons on the board.
  2. The first player/computer to get three of their icons in a row (horizontally, vertically, or diagonally) wins the game.
  3. If all spaces on the board are filled and no player/computer has won, the game is a draw.

Tips:

  1. Try to block the computer from getting three in a row.
  2. Look for opportunities to create two in a row for yourself, as this will give you a good chance to win on the next turn.
  3. Pay attention to the spaces the computer has chosen, as this can give you clues about its strategy.

Example:

.___________. __    ______        .___________.    ___       ______        .___________.  ______    _______
|           ||  |  /      |       |           |   /   \     /      |       |           | /  __  \  |   ____|
`---|  |----`|  | |  ,----' ______`---|  |----`  /  ^  \   |  ,----' ______`---|  |----`|  |  |  | |  |__
    |  |     |  | |  |     |______|   |  |      /  /_\  \  |  |     |______|   |  |     |  |  |  | |   __|
    |  |     |  | |  `----.           |  |     /  _____  \ |  `----.           |  |     |  `--'  | |  |____
    |__|     |__|  \______|           |__|    /__/     \__\ \______|           |__|      \______/  |_______|


Enter the Player Name: adam

-----------
   |   |
-----------
   |   |
-----------
   |   |
-----------

Your turn, Adam. Which space do you want to place your icon?
Enter a number (1-9): 1
Computer is thinking...

-----------
   |   |
-----------
   |   |
-----------
 X | O |
-----------

Your turn, Adam. Which space do you want to place your icon?
Enter a number (1-9): 2
That space is taken. Try again.
Enter a number (1-9): 5
Computer is thinking...

-----------
   |   |
-----------
   | X |
-----------
 X | O | O
-----------

Your turn, Adam. Which space do you want to place your icon?
Enter a number (1-9): 9

-----------
   |   | X
-----------
   | X |
-----------
 X | O | O
-----------

Adam Win! Computer Loses

Good luck and have fun!

About

Tic-Tac-Toe is a classic two-player game where players take turns placing their icons (X or O) on a 3x3 grid. The goal is to get three of your icons in a row before your opponent. It has been enjoyed by all ages for many years

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages