-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
456 additions
and
21 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
3 changes: 2 additions & 1 deletion
3
backend/src/main/java/fr/zelytra/game/pool/data/GameRules.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
4 changes: 4 additions & 0 deletions
4
backend/src/main/java/fr/zelytra/game/pool/data/PoolSilentJoin.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,4 @@ | ||
package fr.zelytra.game.pool.data; | ||
|
||
public record PoolSilentJoin(String username,String sessionId) { | ||
} |
5 changes: 4 additions & 1 deletion
5
...game/pool/game/AmericanEightPoolGame.java → ...l/game/customs/AmericanEightPoolGame.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
40 changes: 40 additions & 0 deletions
40
backend/src/main/java/fr/zelytra/game/pool/game/customs/ManualPoolGame.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,40 @@ | ||
package fr.zelytra.game.pool.game.customs; | ||
|
||
import fr.zelytra.game.pool.data.GameAction; | ||
import fr.zelytra.game.pool.data.PoolBalls; | ||
import fr.zelytra.game.pool.game.PoolGameInterface; | ||
import fr.zelytra.game.pool.game.PoolGameManager; | ||
import fr.zelytra.game.pool.game.PoolVictoryState; | ||
|
||
public class ManualPoolGame extends PoolGameManager implements PoolGameInterface { | ||
|
||
@Override | ||
public void play(GameAction action) { | ||
this.getHistory().add(action); | ||
} | ||
|
||
@Override | ||
public PoolVictoryState winDetection() { | ||
PoolVictoryState victoryState = PoolVictoryState.NONE; | ||
boolean isEightIn = isEightIn(); | ||
PoolVictoryState lastActionTeamId = getLastTeamPlay(); | ||
|
||
if (isEightIn) { | ||
return lastActionTeamId.getInvertTeam(); | ||
} | ||
|
||
return victoryState; | ||
|
||
} | ||
|
||
public boolean isEightIn() { | ||
for (GameAction action : getHistory()) { | ||
for (PoolBalls ball : action.balls()) { | ||
if (ball.number == 8) { | ||
return true; | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
} |
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
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
Oops, something went wrong.