The Game of the Goose or Goose game is a board game where two or more players move pieces around a track by rolling two dice. The aim of the game is to reach square number 63 before any of the other players, while avoiding obstacles such as the Prank.
- Clone project
- This project require java 11 to run
- Run cd src/goose/com on your IDE terminal
- Run javac PlayGame.java
- Run java PlayGame
1. Formatting console messages based on the action taken
2. Too much If-Else statement
3. Methods and variable namings
1. Using strategy & factory pattern for refactoring
2. Using Enum to label particular business logic
As a player, I want to add me to the game so that I can play.
Scenarios:
-
Add Player
If there is no participant the user writes: "add player Pippo" the system responds: "players: Pippo" the user writes: "add player Pluto" the system responds: "players: Pippo, Pluto"
-
Duplicated Player
If there is already a participant "Pippo" the user writes: "add player Pippo" the system responds: "Pippo: already existing player"
As a player, I want to move the marker on the board to make the game progress
Scenarios:
- Start
If there are two participants "Pippo" and "Pluto" on space "Start" the user writes: "move Pippo 4, 2" the system responds: "Pippo rolls 4, 2. Pippo moves from Start to 6" the user writes: "move Pluto 2, 2" the system responds: "Pluto rolls 2, 2. Pluto moves from Start to 4" the user writes: "move Pippo 2, 3" the system responds: "Pippo rolls 2, 3. Pippo moves from 6 to 11"
As a player, I win the game if I land on space "63"
Scenarios:
-
Victory
If there is one participant "Pippo" on space "60" the user writes: "move Pippo 1, 2" the system responds: "Pippo rolls 1, 2. Pippo moves from 60 to 63. Pippo Wins!!"
-
Winning with the exact dice shooting
If there is one participant "Pippo" on space "60" the user writes: "move Pippo 3, 2" the system responds: "Pippo rolls 3, 2. Pippo moves from 60 to 63. Pippo bounces! Pippo returns to 61"
As a player, I want the game throws the dice for me to save effort
Scenarios:
- Dice roll
If there is one participant "Pippo" on space "4" assuming that the dice get 1 and 2 when the user writes: "move Pippo" the system responds: "Pippo rolls 1, 2. Pippo moves from 4 to 7"
As a player, when I get to the space "The Bridge", I jump to the space "12"
Scenarios:
- Get to "The Bridge"
If there is one participant "Pippo" on space "4" assuming that the dice get 1 and 1 when the user writes: "move Pippo" the system responds: "Pippo rolls 1, 1. Pippo moves from 4 to The Bridge. Pippo jumps to 12"
As a player, when I get to a space with a picture of "The Goose", I move forward again by the sum of the two dice rolled before
The spaces 5, 9, 14, 18, 23, 27 have a picture of "The Goose"
Scenarios:
-
Single Jump
If there is one participant "Pippo" on space "3" assuming that the dice get 1 and 1 when the user writes: "move Pippo" the system responds: "Pippo rolls 1, 1. Pippo moves from 3 to 5, The Goose. Pippo moves again and goes to 7"
-
Multiple Jump
If there is one participant "Pippo" on space "10" assuming that the dice get 2 and 2 when the user writes: "move Pippo" the system responds: "Pippo rolls 2, 2. Pippo moves from 10 to 14, The Goose. Pippo moves again and goes to 18, The Goose. Pippo moves again and goes to 22"
As a player, when I land on a space occupied by another player, I send him to my previous position so that the game can be more entertaining.
Scenarios:
- Prank
If there are two participants "Pippo" and "Pluto" respectively on spaces "15" and "17" assuming that the dice get 1 and 1 when the user writes: "move Pippo" the system responds: "Pippo rolls 1, 1. Pippo moves from 15 to 17. On 17 there is Pluto, who returns to 15"