Code Monkey home page Code Monkey logo

othello-esilv's Introduction

Othello Game with AI

This repository contains a Python implementation of the Othello (Reversi) game, including an AI opponent that uses the Minimax algorithm with Alpha-Beta pruning and custom heuristics for different phases of the game.

Quick demo

quick.video.mp4

Getting Started

Prerequisites: Python 3.x Application Installation: Clone the repository:

git clone https://github.com/GuillaumeDorschner/Othello-ESILV.git

Navigate to the project directory:

cd Othello-ESILV

Launching the Game

To start the game, simply run the main.py file:

python main.py

How to Play

At the beginning of the game, the player can choose to play as Black or White. Black always plays first. The chessboard will be displayed in the command line, with B (black), W (white). During their turn, the player must enter the row and column of the desired move. The AI then makes its move, and the updated board is displayed. The game continues until there are no more legal moves for either player or the board is full. The player with the most pieces of their color on the board wins.

Features

  • Textual user interface
  • Human versus AI gameplay
  • Minimax algorithm with Alpha-Beta pruning for AI decision-making
  • Custom heuristics for the early, middle, and endgame phases
  • Ability to display available moves for the current player

AI Strategy

The AI uses a Minimax algorithm with Alpha-Beta pruning to search the game tree and decide on the best move. The evaluation function considers different factors depending on the current game phase (beginning, middle, or end):

Beginning (first 12 moves):

Priority on placing pieces away from the center Priority on capturing pieces Middle (next 36 moves):

Priority on edge and corner positions Priority on capturing pieces Favor moves that allow future mobility End (last 12 moves):

Priority on capturing pieces Priority on important corners These heuristics help the AI adapt its strategy to the evolving game state and create a more challenging opponent.

License

This project is under the MIT license. See the LICENSE file for more details.

othello-esilv's People

Contributors

guillaumedorschner 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.