Software Construction Assignment 3: Parcheesi Rules

Due: April 11, 2017 @ 5pm. Please include a README.txt that has both partner's names and email addresses.

Your task is to implement a Parcheesi rules checker and the basic infrastructure for playing the game.

The program provides an administrator and a player. The administrator manages the board, the remaining tiles, and the game itself. Each player registers with the administrator. Once the game is started, the administrator gives each of the players one turn per round. Note that this assignment does not require you to implement any players, except possibly to test your administrator.

Here is a starting point for your design.

interface Player {

  // inform the player that a game has started
  // and what color the player is.
  void startGame(String color);

  // ask the player what move they want to make
  Move[] doMove(Board brd, int[] dice)

  // inform the player that they have suffered
  // a doubles penalty
  void DoublesPenalty();
}

interface Game {

  // add a player to the game
  void register(Player p);
  
  // start a game
  void start();
}

interface Move {}

// represents a move where a player enters a piece
class EnterPiece implements Move {
  Pawn pawn;  
  EnterPiece(Pawn pawn) {
    this.pawn=pawn;
  }
}

// represents a move that starts on the main ring
// (but does not have to end up there)
class MoveMain implements Move {
  Pawn pawn;
  int start;
  int distance;
  MoveMain(Pawn pawn, int start, int distance) {
    this.pawn=pawn;
    this.start=start;
    this.distance=distance;
  }
}

// represents a move that starts on one of the home rows
class MoveHome implements Move {
  Pawn pawn;
  int start;
  int distance;
  MoveHome(Pawn pawn, int start, int distance) {
    this.pawn=pawn;
    this.start=start;
    this.distance=distance;
  }
}

class Pawn {
  int /* 0-3 */ id;
  String color;
  Pawn (int id, String color) {
    this.id=id;
    this.color=color;
  }
}
Whether you use Java or not, you must structure your program as these interfaces and classes suggest. In Java, you must use these interfaces and classes. You may represent the board any way you like.

The administrator must detect if a player cheats, according to the rules of Parcheesi.

Organization hint One organization for this assignment is to build these two helper functions.

  • The first function accepts a board and a move and returns a new board and a possible bonus die roll (that can be granted by a bop or an entry home).
  • The second accepts the original board, the final board, and the moves. It checks to see if any blockades were moved together and that all of the die rolls were used.
Of course, these two functions break down into many smaller functions.



Software Construction