Reversi

A two-player turn based board game

Reversi, also known as Othello (which has slightly different rules), is a two-player strategy game played on an 8x8 board. One player is assigned the light pieces and the other is assigned dark pieces. The objective is to have the most pieces of one's own color on the board at the end of the game.

I implemented this in Java as my final project for CIS 120, an intro CS course taught using Java and OCaml, in Fall 2013.

A complete game.

Gameplay

The board starts with 2 black and 2 while pieces alternating at the center. During a player's turn, the player can place a new piece on a square if both of the following conditions hold.

  • the square is empty.
  • there is a line of the opponent's pieces connecting the new piece to one of the current player's existing pieces.

Once a player plays a valid move, the colors of all pieces that are in between the new piece and the current player's existing pieces all switch colors to the current player's color. A valid move sequence is shown below.

Players can check for squares with valid moves by hovering their mouse over a square. If the move is valid, a "ghost" piece of their color is shown.

If a valid move does not exist for a player, that player's turn is skipped. When no valid moves remain for either player, the game is over. The player with the most pieces wins.