Implement Resource Payout and Determination of the Winner #19

Merged
thalmma5 merged 10 commits from feature/throw-dice into dev 2021-12-02 23:49:21 +00:00
thalmma5 commented 2021-12-01 19:07:55 +00:00 (Migrated from github.zhaw.ch)

Changes made in this PR will add methods for paying out resources after dices were thrown. Furthermore, this PR adds a method for determining the winner of the game. The method getWinner will make sure to only declare the current player as a winner.

Changes made in this PR will add methods for paying out resources after dices were thrown. Furthermore, this PR adds a method for determining the winner of the game. The method `getWinner` will make sure to only declare the current player as a winner.
zumbrseb (Migrated from github.zhaw.ch) requested changes 2021-12-01 20:04:50 +00:00
zumbrseb (Migrated from github.zhaw.ch) left a comment

Looks good apart from some minor things.

Looks good apart from some minor things.
zumbrseb (Migrated from github.zhaw.ch) commented 2021-12-01 19:52:33 +00:00

Splitting up this if in two methods would help the readability and would probably also explain what's special about 7 without having to write a comment.

Splitting up this if in two methods would help the readability and would probably also explain what's special about 7 without having to write a comment.
zumbrseb (Migrated from github.zhaw.ch) commented 2021-12-01 19:57:31 +00:00

Isn't here a condition missing, if the diceValue of the field is the rolled dice?

Isn't here a condition missing, if the `diceValue` of the field is the rolled dice?
zumbrseb (Migrated from github.zhaw.ch) commented 2021-12-01 19:59:24 +00:00

This could be extracted into a method named findGeneratedResources() or similar

This could be extracted into a method named `findGeneratedResources()` or similar
zumbrseb (Migrated from github.zhaw.ch) commented 2021-12-01 20:00:13 +00:00
                            payoutAmount.putIfAbsent(faction, 0);

```suggestion payoutAmount.putIfAbsent(faction, 0); ```
zumbrseb (Migrated from github.zhaw.ch) commented 2021-12-01 20:01:04 +00:00

Maybe also extract the condition checking into a separate method, depending on how difficult it gets to read.

Maybe also extract the condition checking into a separate method, depending on how difficult it gets to read.
@ -222,0 +294,4 @@
for (Player player : players) {
result.put(player.getFaction(), new ArrayList<>());
}
zumbrseb (Migrated from github.zhaw.ch) commented 2021-12-01 19:51:48 +00:00

A player could have more than one resource too many. This should be repeated until the card count is lower or equal then MAX_CARD_IN_HAND_NO_DROP.

A player could have more than one resource too many. This should be repeated until the card count is lower or equal then MAX_CARD_IN_HAND_NO_DROP.
zumbrseb (Migrated from github.zhaw.ch) commented 2021-12-01 20:03:29 +00:00
     * @return Gets the number of resources which are in possession of the player.
```suggestion * @return Gets the number of resources which are in possession of the player. ```
thalmma5 (Migrated from github.zhaw.ch) reviewed 2021-12-02 08:30:56 +00:00
thalmma5 (Migrated from github.zhaw.ch) commented 2021-12-02 08:30:56 +00:00

The condition for getting fields for the correct diceValue is stored here:
fe0175c739/app/src/main/java/ch/zhaw/catan/SiedlerGame.java (L223)

The condition for getting fields for the correct `diceValue` is stored here: https://github.zhaw.ch/PM1-IT21bWIN-bles-gann-wino/gruppe02-slothbusters-projekt3-catan/blob/fe0175c739954d3a190db45d09bc783203a2ead5/app/src/main/java/ch/zhaw/catan/SiedlerGame.java#L223
Sign in to join this conversation.
No description provided.