-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare for GamePhaseController implementation
- Loading branch information
Robert Lukoťka
committed
Nov 3, 2024
1 parent
88415aa
commit 1a33c90
Showing
7 changed files
with
123 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package sk.uniba.fmph.dcs.stone_age; | ||
|
||
public enum ActionResult { | ||
FAILURE, | ||
ACTION_DONE, | ||
ACTION_DONE_WAIT_FOR_TOOL_USE, | ||
ACTION_DONE_ALL_PLAYERS_TAKE_A_REWARD, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package sk.uniba.fmph.dcs.stone_age; | ||
|
||
public enum HasAction { | ||
WAITING_FOR_PLAYER_ACTION, | ||
AUTOMATIC_ACTION_DONE, | ||
NO_ACTION_POSSIBLE, | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/sk/uniba/fmph/dcs/stone_age/InterfaceGamePhaseController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package sk.uniba.fmph.dcs.stone_age; | ||
|
||
import java.util.Collection; | ||
|
||
public interface InterfaceGamePhaseController { | ||
boolean placeFigures(PlayerOrder player, Location location, int figuresCount); | ||
|
||
boolean makeAction( | ||
PlayerOrder player, | ||
Location location, | ||
Collection<Effect> inputResources, | ||
Collection<Effect> outputResources); | ||
|
||
boolean skipAction(PlayerOrder player, Location location); | ||
|
||
boolean useTools(PlayerOrder player, int toolIndex); | ||
|
||
boolean noMoreToolsThisThrow(PlayerOrder player); | ||
|
||
boolean feedTribe(PlayerOrder player, Collection<Effect> resources); | ||
|
||
boolean doNotFeedThisTurn(PlayerOrder player); | ||
|
||
boolean makeAllPlayersTakeARewardChoice(PlayerOrder player, Effect reward); | ||
|
||
String state(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package sk.uniba.fmph.dcs.stone_age; | ||
|
||
public enum Location { | ||
TOOL_MAKER, | ||
HUT, | ||
FIELD, | ||
HUNTING_GROUNDS, | ||
FOREST, | ||
CLAY_MOUND, | ||
QUARY, | ||
RIVER, | ||
CIVILISATION_CARD1, | ||
CIVILISATION_CARD2, | ||
CIVILISATION_CARD3, | ||
CIVILISATION_CARD4, | ||
BUILDING_TILE1, | ||
BUILDING_TILE2, | ||
BUILDING_TILE3, | ||
BUILDING_TILE4, | ||
} |
59 changes: 59 additions & 0 deletions
59
src/main/java/sk/uniba/fmph/dcs/stone_age/PlayerOrder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package sk.uniba.fmph.dcs.stone_age; | ||
|
||
public final class PlayerOrder { | ||
private int order; | ||
private int players; | ||
|
||
public PlayerOrder(final int order, final int players) { | ||
this.order = order; | ||
this.players = players; | ||
} | ||
|
||
public int getOrder() { | ||
return order; | ||
} | ||
|
||
public int getPlayers() { | ||
return players; | ||
} | ||
|
||
public PlayerOrder forward() { | ||
int forward = (this.order + 1) % this.players; | ||
return new PlayerOrder(forward, this.players); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
final int prime = 31; | ||
int result = 1; | ||
result = prime * result + order; | ||
result = prime * result + players; | ||
return result; | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object obj) throws IllegalArgumentException { | ||
if (this == obj) { | ||
return true; | ||
} | ||
if (obj == null) { | ||
return false; | ||
} | ||
if (getClass() != obj.getClass()) { | ||
return false; | ||
} | ||
PlayerOrder other = (PlayerOrder) obj; | ||
if (order != other.order) { | ||
return false; | ||
} | ||
if (players != other.players) { | ||
throw new IllegalStateException(); | ||
} | ||
return true; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "PlayerOrder [order=" + order + "]"; | ||
} | ||
} |