Skip to content

A simple console-based implementation of the classic Tic Tac Toe game in Python. Players take turns to place their symbols on a 3x3 grid, aiming to get three in a row horizontally, vertically, or diagonally. Includes functions for player input, board printing, and win-checking. Enjoy the nostalgic fun of Tic Tac Toe!

License

Notifications You must be signed in to change notification settings

jakubswi/Tic-Tac-Toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Tic Tac Toe Game

This is a simple implementation of the Tic Tac Toe game in Python.

How to Play

  1. Run the Python script.
  2. Players take turns to choose a cell on the board to place their symbol.
  3. The first player to get three of their symbols in a row (horizontally, vertically, or diagonally) wins the game.
  4. If all cells are filled and no player has won, the game ends in a draw.

Requirements

  • Python 3.x

Usage

  1. Clone the repository or download the Python script.
  2. Open a terminal or command prompt.
  3. Navigate to the directory containing the Python script.
  4. Run the script using the command:
    python tictactoe.py
    

Functionality

  • ask_player(player_num, board): Function to prompt the current player to choose a row and column for their move. Checks for valid input and whether the selected cell is already taken.
  • printing_matrix(matrix): Function to print the Tic Tac Toe board.
  • check_for_win(matrix): Function to check if a player has won the game. It checks for three consecutive symbols in rows, columns, and diagonals.
  • The game is played in an infinite loop until a player wins or the game ends in a draw.

License

This project is licensed under the MIT License.

Enjoy playing Tic Tac Toe! 🎮

About

A simple console-based implementation of the classic Tic Tac Toe game in Python. Players take turns to place their symbols on a 3x3 grid, aiming to get three in a row horizontally, vertically, or diagonally. Includes functions for player input, board printing, and win-checking. Enjoy the nostalgic fun of Tic Tac Toe!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages