-
Notifications
You must be signed in to change notification settings - Fork 0
Iteration 4
Implementation of both player movement features took place within the same controller method. This was possible since the 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 side) Performs the movement of the player's pawn during the respective player's turn. When the method is called, the feature will first check if there is a wall in hand. If so, the feature cannot be implemented since the keyboard movements will be allocated towards the wall. The following step is to verify with the transfer object which button was clicked by the user in the UI. According to the button clicked, the movement of the pawn will be mapped into the boardgame through the state machine. The last condition is to check whether the movement is legal within the current game state either due to blockages from walls or from edge cases of the board game.
Helper Method:
- isRunning() -check if the game is running
Feature 1: Move Pawn
Perform a player step that only moves the pawn a single tile adjacent from the player's current position. This can only be performed if there are no obstacles in the adjacent tile the player wishes to move toward.
Feature 2: Jump Pawn
Perform a player jump that allows the pawn to jump over tiles in specific conditions. The two conditions are the following: a pawn can jump over another pawn and a pawn can jump diagonally.
- A player can jump over another pawn orthogonally in a straight line towards a neighboring square in one move as long as no walls are crossed.
- If there is a wall behind the opposing player's pawn, a jump is permitted to one of the free squares adjacent to the jumped pawn.
Feature 1: Move Pawn
Fully implemented and fully pass all step definitions.
Feature 2: Jump Pawn
Fully implemented and fully pass all step definitions.
TOPlayer
- enum Color {White,Black};
- enum Side {Up,Down,Left,Right,UpRight,UpLeft,DownRight,DownLeft);
- Integer row;
- Integer col;
- Color color;
- getPlayers() - Gets the list of player transfer objects.
Group 10 | ECSE 223 Model Based Programming