Skip to content

Iteration 1

ashaduzzamane edited this page Sep 29, 2019 · 30 revisions

Iteration 1 - Domain Model

Introduction

The first iteration consisted of creating the Umple domain model for the Quoridor game and generating the code from the model. You can view the diagram as well as the code implemented by our team below.

Umple Diagram

Our Umple diagram can be found here.

Code

class Quoridor{
   0..1 <@>- * Game;
   0..1 <@>- 1 PlayerList; 
}
class PlayerList{
0..1 <@>- * Player gamePlayers;
}
class Player{
  unique userName;
  Integer playerScore;
  Integer playerWin;
  Integer playerLoss;
  Integer playerTie;
  0..1 -> 0..1 Pawn currentPawn;
}
class Game{
  Boolean isOver;
  0..1 -> 0..1 Player winner;
  0..1 <@>- 1 Board gameBoard;
  0..1 <@>- * Move moves;
    0..1 <@>- 1 Position boardPosition;
}
class Board{
   0..1 <@>- 2 Pawn pawns;
   0..1 <@>- 0..20 Wall walls;
}
class Position{
0..1 blackPawnPosition -> 0..1 Pawn blackPawn;
0..1 blackWallPosition->  0..10 Wall blackWalls;
0..1 whitePawnPosition <@>- 0..1 Pawn whitePawn;
0..1 whiteWallPosition <@>- 0..10 Wall whiteWalls;
}
class Pawn{
0..1 ->  1 Cordinate cordinate;
  Time remainingTime;
  Integer wallStock;
}
class Wall {
  enum orientation{Horizontal, Vertical};
  enum state{Highlighted,NotHighlighted};
   0..10 -- 1 Pawn wallOwner;
  0..1 -> 1 Cordinate cordinate;
}
class Move{
  abstract;
  0..1 ->0..1 Pawn user;
}
class Cordinate{
  Integer x; 
  Integer y;
}

class PawnMove{
  isA Move;
  0..1->  1 Cordinate cordinate;
}
class AddWall{
  isA Move;
  0..1 ->  1 Cordinate wallCord;
  enum orientation{Horizontal, Vertical};
}
class Jump{
  isA Move;
  0..1 ->  1 Cordinate jumpTo;
}

Classes

Game

Game is the main system performing the operation of actions on the board, player, and walls.

Player

Object storing the unique usernames and game records. It is associated with the pawn once the game is initialized.

PlayerList

The player list is composed of the player who is created. Players can be selected from the list to initialize the game.

Board

Board is composed of the 2 pawns and the 20 walls. The walls are initially on the outer layer (stock) of the board and as the game progresses, players add their walls inside the board.

Quoridor

Quoridor is the system that contains the game and the player list.

Pawn

The pawn represents the piece that is intended moves to the opposite side of the board in order to win the game. Each player has only one pawn throughout the entirety of the game.

Wall

The wall represents the piece that is intended to obstruct the opponent's pawn from reaching the opposite side of the game. Each player has exactly 10 walls to start the game.

Move

The move is the superclass for various actions that can be performed within the game (Namely PawnMove, AddWall, and Jump).

Coordinate

Represents the unique alpha-numeric value of the position.

Position

Keeps a record of every pawn and wall in the game. The distinct association is made based on the colour of the pawn and the specific user's wall.

PawnMove

A normal action that a pawn can perform during the game. The action moves the pawn to the adjacent position that is not blocked.

AddWall

An action that adds the wall to the board.

Jump

A unique scenario that allows a pawn to jump over the other user's pawn only when they are adjacent to one another.