Giter Site home page Giter Site logo

ayushvarma7 / checker_ai Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 60 KB

A Checker game against Computer using Minmax Algorithm

Home Page: https://compassionate-knuth-9a920d.netlify.app/

JavaScript 88.74% CSS 7.44% HTML 3.83%
random minimax-algorithm alpha-beta-pruning checkers-game

checker_ai's Introduction

Checker Board Game on a 8x8 square matrix

Aim: To WAP for playing checkers games with a computer using the following game playing strategies discussed in class:

a. Random

b. Mini-Max

c. Alpha-Beta Pruning

Rules of the game are following-

Movement Rules:

A. The ordinary movement of a man:

  1. A man moves diagonally forward left or right from one square to an immediately neighboring vacant square.
  2. When a man reaches the farthest row forward (the king-row: top or bottom row for opponent player – marked with red in the diagram) it becomes a king. B. The ordinary movement of a king (crowned man):
  3. The king moves from one square diagonally forward or backward, left or right, to an immediately neighbor vacant square.

Capturing Movement Rules:

  1. To capture the opponent’s piece, a man moves from one square over a diagonally adjacent and forward square that is occupied by an opponent’s piece and on to a vacant square immediately beyond it. On completion of the jump the captured piece is removed from the board.
  2. The capturing movement of a king is similar to a man, but it can move both directions, forward and backward direction.
  3. The capturing move of the piece (man or king) is continued until all the jumps are completed. Exception: if a man reaches the king-row by means of a capturing move, it then becomes a king but may not make any further jumps in the same turn.
  4. All capturing moves are compulsory, whether offered actively or passively. If there are two or more ways to jump, a player might select any one he wishes, not necessarily that which gains most pieces. Once started, a multiple jump must be carried through to completion.

Definition of a Win

  1. The winner of the game is one who can make the last move; that is, no move is available to the opponent on his turn to play, either because all his pieces have been captured or his remaining pieces are all blocked. Definition of a Draw
  2. The 50-move rule: The game shall be declared drawn if, at any stage of the game satisfy one of the followings: a. Neither player has advanced an uncrowned man towards the king-row during the previous 50 moves. b. No pieces have been removed from the board during the previous 50 moves.

Step Choosing Strategy:

• If there is a capture step, it has to choose that step (refer to rule 7). • Choose step that minimizes the number of possibilities of steps (steps without being captured) of the opponent. • Choose the step that has possibility to capture more than one piece. • Choose step so that it can keep the lanes to the king's row blocked for the opponent. • Choose step that can capture the pieces of the opponent, but the opponent can’t do. • Looking for step that can move between the own pieces and the opponent in order to move adjacent to an opposing checker without loss. • Choose step in which if the opponent capture one piece, it can capture the opponent at least one piece. • Choose the step that can reach the farthest row safely in order to become a king.

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.