Skip to content
rwsargent edited this page Apr 14, 2020 · 3 revisions

Quoridor

Model

Quoridor's board is modeled as a 19x19 grid, where each cell represents a square a pawn can sit on or a gutter a barrier can fit in. If the board is laid out with the top left most cell at (0,0), the player sits along the bottom row, cells (0,19) through (19,19).

  • Pawns are only valid on cells even coordinates, e.g. (0, 0), (0, 2), (2, 0)
  • Barriers span 3 cells, and cannot start on a cell with two odd coordinates. The must start on a cell with an even and odd coordinate (e.g. (1, 0), (0, 1)), with enough room for three cells. When discussing the position of a barrier, only specify the coordinate that is closest to the origin (0,0);

API

MovePawn(PlayerPosition, Destination) error

PlaceBarrier(PlayerPosition, Destination) error

Implementation

The state of a Quoridor game is a Board and some associated metadata. The board is a list of Pieces. A Piece is a Position, Type, and Owner. The Owner field is an index into a Player array also stored in the Game object. The type is a character, either 'p' for a Pawn, or 'b' for a Barrier. A game is started if the StartTime is non-zero, and a game is over if the EndTime is non-zero.

struct Position {
 X, Y int
}

type PlayerPosition int;

type TypeId rune
const(
    Pawn TypeId = 'p'
    Barrier TypeId = 'b'
)
struct Piece {
  Position Position,
  Type TypeId ,
  Owner PlayerPosition
}

struct Player {
   // TODO
}

struct Game {
  Board [Position]Piece
  StartTime, EndTime time.Time
  Players []Player
  CurrentTurn PlayerPosition
}
Clone this wiki locally