This is Checkers Game Engine

with a random bot

What is it?

Today, I implemented an engine for checkers. This is the 3rd version of my implementation since the last two were not well-designed (my bad!) for implementing an AI bot; which I am planing to do in the next few weeks.

Here is some rules implemented in this engine

  1. There are two types of pieces: knight and king. Each player will start with 8 knights each.
  2. Knights can only move one diagonal space forward (towards their opponents pieces).
  3. To capture an opposing piece, a piece "jump" over it by moving two diagonal spaces in the direction of the the opposing piece. Note that the space on the other side of the captured piece must be empty for you to capture it.
  4. A piece may jump consecutively over an opponent's pieces to capture all of them at the same time.
  5. Jumps are compulsory. As long as you have an opportunity to capture, you must take it no matter what.
  6. If a piece can continue to jump once it has jumped, it must do so in the same turn.
  7. If there is more than one alternative for capture, you may choose which one to take. It need not be the path that takes the most pieces.
  8. If your piece reaches the last row on the opponent's side, it will be promoted into a king.
  9. When a knight is kinged, the turn automatically ends, even if the king can continue to jump.
  10. Kings can only move diagonally but any number of space at a time. They may move diagonally forward or backwards.
  11. There is no limit to how many king pieces a player may have
  12. The game is won when all the opponent's pieces are captured or (putting them into a position where they cannot move).
  13. If an exact board position is repeated a third time, the game automatically ends in a draw.
  14. If 50 moves have taken place (for both players) since the last capture or advancement of a regular checker, the game ends in a draw.

More detail can be see here