feat: Implement player winning state at startup #98
3 changed files with 13 additions and 2 deletions
|
@ -33,7 +33,8 @@ public class BlackJackGameEntity {
|
||||||
return user != null ? user.getId() : null;
|
return user != null ? user.getId() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String state;
|
@Enumerated(EnumType.STRING)
|
||||||
|
private BlackJackState state;
|
||||||
private BigDecimal bet;
|
private BigDecimal bet;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "game", cascade = CascadeType.ALL, orphanRemoval = true)
|
@OneToMany(mappedBy = "game", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class BlackJackService {
|
||||||
BlackJackGameEntity game = new BlackJackGameEntity();
|
BlackJackGameEntity game = new BlackJackGameEntity();
|
||||||
game.setUser(user);
|
game.setUser(user);
|
||||||
game.setBet(betAmount);
|
game.setBet(betAmount);
|
||||||
game.setState("IN_PROGRESS");
|
game.setState(getState(game));
|
||||||
initializeDeck(game);
|
initializeDeck(game);
|
||||||
|
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
|
@ -63,4 +63,8 @@ public class BlackJackService {
|
||||||
|
|
||||||
return game.getDeck().removeFirst();
|
return game.getDeck().removeFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private BlackJackState getState(BlackJackGameEntity game) {
|
||||||
|
return BlackJackState.IN_PROGRESS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package de.szut.casino.blackjack;
|
||||||
|
|
||||||
|
public enum BlackJackState {
|
||||||
|
PLAYER_WON,
|
||||||
|
IN_PROGRESS
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue