Skip to content

Sprint 4

Ali Tapan edited this page Nov 19, 2019 · 6 revisions

The deliverable 4 consisted of creating a state machine for the implementing the feature 'Move Pawn' and 'Jump Pawn'. The state machine diagram can be seen below, it approaches the problem of using "No Adjacent Opponent" and "Adjacent Opponent" cases as 2 main states and further expands by checking for walls.

State Machine Diagram Example (3)

The helper methods that triggers, guards and actions the state machine that are used is as follows:

  • isLegalStep() - Returns if it is legal to step in the given direction
  • isLegalJump() - Returns if it is legal to jump in the given direction
  • illegalStep() - Returns if it is legal to step in the given direction
  • isLegalJump() - Returns if it is legal to jump in the given direction
  • illegalMove() - Action to be called when an illegal move is attempted
  • getCurrentPawnRow() - Returns the current row number of the pawn
  • getCurrentPawnColumn() - Returns the current column number of the pawn
Clone this wiki locally