feat: Implement player winning state at startup #98

Merged
ptran merged 2 commits from feat/state-enum into main 2025-03-27 11:49:38 +00:00
3 changed files with 13 additions and 2 deletions
Showing only changes of commit caa210a80e - Show all commits

View file

@ -33,7 +33,8 @@ public class BlackJackGameEntity {
return user != null ? user.getId() : null;
}
private String state;
@Enumerated(EnumType.STRING)
private BlackJackState state;
private BigDecimal bet;
@OneToMany(mappedBy = "game", cascade = CascadeType.ALL, orphanRemoval = true)

View file

@ -23,7 +23,7 @@ public class BlackJackService {
BlackJackGameEntity game = new BlackJackGameEntity();
game.setUser(user);
game.setBet(betAmount);
game.setState("IN_PROGRESS");
game.setState(getState(game));
initializeDeck(game);
for (int i = 0; i < 2; i++) {
@ -63,4 +63,8 @@ public class BlackJackService {
return game.getDeck().removeFirst();
}
private BlackJackState getState(BlackJackGameEntity game) {
return BlackJackState.IN_PROGRESS;
}
}

View file

@ -0,0 +1,6 @@
package de.szut.casino.blackjack;
public enum BlackJackState {
PLAYER_WON,
IN_PROGRESS
}