Reversi

Reversi is also known as Othello, played with reversible black/white tokens on an 8x8 board.

  • Reversi Overview
  • The game of Reversi, also known as Othello, is played with reversible white/black tokens on an 8x8 board. Read the rules on Wikipedia. A play must bracket and flip at least one of the opponent’s pieces. You can play reversi online if you need to get familiar with the game. Don’t waste a lot of time on. Once you have a working two-player reversi, then you can start thinking about a computer player.

  • Reversi Structs
  • Structures used in reversi.

  • Reversi Placement
  • A basic mechanic of placing pieces on the board.

  • Reversi Indicator
  • Instructions to add an indicator showing where you will place a piece.

  • Reversi Ray
  • A variant on the true game of Reversi.

  • Reversi Board
  • The first issue in dealing with “true reversi” is getting pieces from the board. Board Access We will write a function to get the piece at a given location on the board. This would be simple, except what should we do when that location is empty? Unoccupied We will make a special piece that we use to indicate that the location is empty. You should make your own by filling in ZZZ with an appropriate string or number.

  • Reversi Flip Plan
  • In “true reversi”, a play is required to flip one of the opponent’s pieces. There are multiple sensible ways for you to program piece flipping, one is explained here. This outline is just for context; there is nothing to write (yet) using the information on this page. Flipping Plan Determine how many steps in a given direction should be flipped. In this plan, this is the most important step. It is described below.

  • Reversi Count Flips
  • The plan is to count how many pieces will flip in a given direction. The key part of this is a helper function that knows how many pieces would be flipped so far in the analysis and a location (posn) the board to continue analyzing. Attachments reversi-flip-examples.pdf (1383 kB) The attachments are intended to be used to write check-expects for the count-flip-help. Count Flip Outline Counting how many pieces flip is done by summing the numbers of pieces that are flipped in each direction.

  • Reversi Stack
  • This page describes a variation called “Reversi Stack”. Big Picture A Piece now includes a stack field to count how many pieces are stacked up at that location. (define-struct piece-stack (team loc stack)) Playing on your own stack increases the number of pieces in your stack by one. Playing on an empty square makes a stack of one of your own pieces. Playing on an opponent’s stack decreases the size of the stack by one, leaving the square empty if there are zero pieces in the stack.


Reversi Overview

Reversi Structs

Structures used in reversi.

Reversi Placement

A basic mechanic of placing pieces on the board.

Reversi Indicator

Instructions to add an indicator showing where you will place a piece.

Reversi Ray

A variant on the true game of Reversi.

Reversi Board

Reversi Flip Plan

Reversi Count Flips

Reversi Stack