Conversation
updated game so dealer cannot hit if he has more than 16 points
added entities for card and person in model
created player & card repo, service and controllers
cannot access players cards in blackjackgameview class
| } | ||
| } | ||
|
|
||
| hit() { |
There was a problem hiding this comment.
It does not make sense to say
A
BlackJackGameStatecanhit.
It makes sense to say
A
BlackJackPlayercanhit.
Never compromise design for functionality.
There was a problem hiding this comment.
| const playerScore = this.blackJackGameData.getPlayer().getHandTotal(); | ||
| const dealerScore = this.blackJackGameData.getDealer() | ||
| const playerScore = this.blackJackGameData.getPlayer() | ||
| if (playerScore > dealerScore && playerScore < 22) { |
There was a problem hiding this comment.
if playerScore is a Player object, how could the line below be a reasonable expression?
playerScore < 22.
playerScore is not an integer, so how could we compare it to 22?
| } | ||
|
|
||
|
|
||
| create(player) { |
There was a problem hiding this comment.
it makes more sense to me for communication to backend to be handled in a separate class and file.
Perhaps consider creating a BlackJackGameService.
| // a blackjack player should receive a name when created | ||
| // a black jack player's hand is empty until receiving cards from a dealer | ||
| constructor(name) { | ||
| constructor(name, cards) { |
There was a problem hiding this comment.
passing cards as an argument seems a bit useless.
This is especially true when we consider that the argument is never used, but even if it were used, I can't imagine it being useful.
| @JoinColumn(name = "player_id") | ||
| private List<Card> cards; | ||
|
|
||
| public Player() { |
There was a problem hiding this comment.
We should rename this class to BlackJackPlayerState.
|
|
||
| @RequestMapping(value="/read-all", method= RequestMethod.GET) | ||
| public ResponseEntity<List<Player>>readAll(){ | ||
| return null; |
There was a problem hiding this comment.
no method implementation here?
this should have CRUD operations at the least
| this.blackJackGameDataView.setNumberOfCardsOnScreen(); | ||
| this.blackJackGameDataView.checkAndUpdateWinner(); | ||
| this.blackJackGameDataView.setActiveOnCurrentPlayer(); | ||
| if( !this.blackJackGameData.isCurrentPlayerDealer()||(this.blackJackGameData.isCurrentPlayerDealer() && this.blackJackGameData.getCurrentPlayer().getHandTotal() <=16)) { |
There was a problem hiding this comment.
it seems like this logic should be moved to the BlackJackDealer and BlackJackPlayer class
minor refactoring
added readall method in blackjackplayer controller
No description provided.