Giter Site home page Giter Site logo

tic-tac-toe's Introduction

Tic-Tac-Toe with Minimax alpha beta pruning and bitboards

A hobby project implementing the Minimax algorithm with alpha-beta pruning to play Tic Tac Toe. This implementation uses bitboards to efficiently represent the game state and uses a transposition table to reduce computational complexity.

Features

  • Minimax Algorithm: Implemented with alpha-beta pruning to find the best move for the current player.
  • Bitboard Representation: Efficiently represents the game state using bitboards, allowing for fast evaluation of moves.
  • Transposition Table: Stores the results of previous evaluations to reduce computational complexity.
  • User-Friendly Interface: Play against the AI or make moves manually.
  • Game Loop: Handles the main game loop, including making moves, checking for wins, and determining the winner.

How to Play

  1. Clone the repository and run the script.
  2. Choose your player symbol (X or O) when prompted.
  3. Make moves by entering the number of the space where you'd like to place your symbol (1-9).
  4. The AI will make its moves automatically.
  5. The game will end when a player wins or the board is full (tie).

Technical Details

  • Bitboard Masks: Used to efficiently update the game state and check for wins.
  • Minimax Function: Implements the Minimax algorithm with alpha-beta pruning to find the best move.
  • Get Best Move: Finds the best move for the current player based on the Minimax algorithm.
  • User Move: Handles user input and updates the game state accordingly.

Contributing

If you'd like to contribute to this project, please open a pull request with your suggested changes.

tic-tac-toe's People

Contributors

yui-koi avatar

Stargazers

 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.