/python-tictactoe

My version of the game "Tic Tac Toe" made in python.

Primary LanguagePython

Tic Tac Toe

This is a simple implementation of the classic Tic Tac Toe game using Python and the Pygame library. The game features a graphical interface and allows two players to take turns placing their symbols on a 3x3 grid. The game ends when one player gets three in a row or when the board is full, resulting in a tie.

Getting Started

Prerequisites

Make sure you have Python installed on your machine. You can download Python from python.org.

Installing Dependencies

To run the game, you need to install the Pygame library. You can install it using the following command:

pip install pygame

Running the Game

Execute the tic_tac_toe.py script to start the game:

python tic_tac_toe.py

How to Play

  • The game starts with a random player, either 'Crosses' or 'Circles'.
  • Players take turns clicking on an empty cell to place their symbol.
  • The game ends when one player gets three in a row horizontally, vertically, or diagonally.
  • If all cells are filled and no player has won, the game is a tie.

Features

  • Dark and light color themes (selectable in the script).
  • On-hover highlighting of empty cells.
  • Simple scoring system to keep track of wins for 'Crosses' and 'Circles'.
  • Press 'R' to restart the game during play.
  • Press 'Esc' to exit the game.

Colors

The game provides two color themes:

Dark Mode

  • Background: Dark Gray
  • Line Color: Cream
  • Cross Color: Red
  • Cross Ghost Color: Light Red
  • Circle Color: Lime
  • Circle Ghost Color: Light Lime
  • On-hover Color: Light Gray

Light Mode

  • Background: Cream
  • Line Color: Black
  • Cross Color: Red
  • Cross Ghost Color: Light Red
  • Circle Color: Lime
  • Circle Ghost Color: Light Lime
  • On-hover Color: Dark Cream

Feel free to customize the color styles in the script according to your preferences.

Enjoy playing Tic Tac Toe!

this README was made with the help of ChatGPT.