Skip to content

Iteration 4

Enan Ashaduzzaman edited this page Nov 17, 2019 · 28 revisions

Iteration 4 - State Machines

Implementation of the Player Movement Features

Implementation of both player movement features took place within the same controller method. This was possible since the created state machine would handle the logic of whether or not the pawn should move or jump at a specific instance in the game.

Controller Method

movePawn(TOPlayer.side)

Feature 1: Move Pawn

  1. rotateWall() Perform the rotation of a selected wall during a player's turn. When this feature is called, the feature will first check if the player has an active wall on the board. If so, the feature can be implemented. If the wall is horizontal before the feature is performed, then the wall will become vertical after the feature is called. The vice versa of the previous statement is also true.

Helper Method:

  1. isRunning() -check if the game is running

Rotate Wall Operation

Feature 2: Jump Pawn

  1. grabWall() Perform the grabbing of a wall from the wall stock of the respective player who calls this feature. The feature will first check if the wall stock if empty. If it is empty, it will throw a message to the user indicating this scenario. The feature then checks if there is already an active wall on the board. If there is already an active wall on the board, the user should not be able to grab another wall. If both of the previous scenarios pass, the feature will grab a wall from the respective player's wall stock and place it on the board game.

Grab Wall Operation

Helper Method:

  1. isRunning() - check if the game is running

Step Definitions (Gherkins Scenario Mappings)

Feature 1: Move Pawn
Fully implemented and fully pass all step definitions.
Feature 2: Jump Pawn
Fully implemented and fully pass all step definitions.

Transfer Objects

TOPlayer

  • enum Color {White,Black};
  • enum Side {Up,Down,Left,Right,UpRight,UpLeft,DownRight,DownLeft);
  • Integer row;
  • Integer col;
  • Color color;

Query Methods

Le-Li Mao

  1. getCurrentPlayerName() - Get the name of the current player to notify the user it is their turn after drop wall
  2. getWhiteWallInStock() - Return the number of walls in stock for the white player
Clone this wiki locally