Gambit

Gambit is an abstract strategy game (think checkers/chess) for two players. It can be played using any standard chess or checker set. You can also play it online against other people or against an AI player.

You can also use a terminal based client:

Rules

The board is 8 spaces wide and 4 spaces deep. The two (2) players face each other along the 8 space wide sides of the board, with 4 spaces between them.

A line of 8 pieces for each player are setup one piece away from the player, like:

Player X ---------- | | |XXXXXXXX| |OOOOOOOO| | | ---------- Player O

Each player takes turns making moves.

Pieces are moved by jumping over a single piece of the opposing team in a straight line in any direction (orthogonal or diagonal) onto an empty space. The piece that has been jumped over is removed from the board.

If a subsequent move is available, the same piece can make multiple jumps in a row before the turn is over. Multiple jumps is optional, so a player can pass after the first jump even if moves are available. But a player must make at least one jump per turn. The subsequent moves do not have to be in the same direction as the original jump.

The game ends when any player is unable to make a move on their turn. The board is then scored.

Players earn points for each island of pieces they have on the board. An island is a group of piece from the same side that does not touch any pieces of the opposing player, including diagonally. Scores are by the number of pieces per island, added up for all islands for a player.

Scores per island:

1 piece
1 point
2 pieces
3 points
3 pieces
5 points
4 pieces
7 points
5 pieces
9 points

The player with the most points wins.

Technical Details

The online implementation of Gambit is developed mainly using Haxe, allowing code reuse on multiple platforms.

The Haxe code is then transpiled into several targets:

  • PHP Server Code
  • C++ Terminal Client (using NCurses)
  • JS for a Website Client

The code is also run in interpreted mode to compile the AI database.

The server uses Redis for persistence.