Giter Club home page Giter Club logo

tic_tac_toe_python_implementation's Introduction

Tic-Tac-Toe Game 🎲

Welcome to the interactive Tic-Tac-Toe game! This Python-based application allows you to play the classic game against an AI with three levels of difficulty. You can choose to go first or second and select your preferred symbol, 'X' or 'O'.

📝 Requirements

Make sure you have Python 3 installed. If not, you can download it from here.

🚀 How to Run the Program

  1. Download the .py file of the program.
  2. Open your terminal or command prompt.
  3. Navigate to the directory containing the file.
  4. Run the following command:
python TicTacToe_Python.py

🎮 How to Play

Once the program is running, you'll be prompted to choose the difficulty level:

  • Easy: The computer makes moves at random.
  • Medium: The computer makes strategic moves but doesn't always play optimally.
  • Hard: The computer uses the Minimax algorithm to determine the best move, making it a tough opponent.

Next, the game board will be displayed. The board is a 3x3 grid, corresponding to positions 1 through 9 as follows:

◻️ | ◻️ | ◻️

◻️ | ❌ | ◻️

◻️ | ◻️ | ⭕

You'll be asked to select a position on the board for your move. For instance, if you want to place your symbol in the top-left corner of the board, enter '1'. If the chosen position is already occupied or is not a valid number between 1 and 9, you'll be asked to try again.

The game continues, alternating between you and the computer, until there is a winner or all positions on the board are filled (resulting in a draw). The game automatically checks for a win after each move. The win conditions are any row, column, or diagonal filled with the same symbol.

After a game ends, you have the option to play again, quit, or return to the main menu to change the difficulty level. 🏆

tic_tac_toe_python_implementation's People

Contributors

minakoaino avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.