GithubHelp home page GithubHelp logo

chinese-checker-ai's Introduction

Chinese Checkers AI Agent

An AI agent capable of playing Chinese Checkers using Minmax Algorithm with varying levels of difficulty.

How the AI decides

The board is represented as a 17x25 array of strings, with “R” representing the AI, “B” representing the player and “.” representing an empty cell. Each player’s goal is to move all of their set of marbles to the opposite side of the board (replacing the opponent’s marbles) Each player has the furthest opposite cell vertex as their goal, so the board is scored based on the sum of each marble’s distance and the goal vertex using Euclidean distance

# game_controller.py
def euclidean_distance(self, start, end):    
    num1 = pow(end[0] - start[0], 2)    
    num2 = pow(end[1] - start[1], 2) // 2    
    return sqrt(num1 + num2)

The AI decides based on the difference between its board score and the human board score, so naturally, a negative score indicates that the player is closer to the goal than the AI and vice versa

How to run this game

  1. First install the project requirements
pip install requirements.txt
  1. simply run the main.py file with the difficulty of choice (1 for easy, 3 for medium and 5 for hard)
python main.py [difficulty]

ScreenShots

Game Start mid game Ai winning

chinese-checker-ai's People

Contributors

omaratef10 avatar omarkhaledm21 avatar vcelistmc 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.