mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-31 07:02:27 -08:00
Add Blackjack/java outline with TODO placeholders
This commit is contained in:
@@ -2,9 +2,15 @@ import java.util.LinkedList;
|
||||
|
||||
public class Player {
|
||||
|
||||
// TODO add 'playerNumber' property. e.g. playerNumber = 1 means "this is Player 1"
|
||||
private int currentBet;
|
||||
private int total;
|
||||
private LinkedList<Card> hand;
|
||||
private LinkedList<Card> hand;
|
||||
// TODO we'll need to decide how to deal with a split hand or doubled down bet.
|
||||
|
||||
public Player() {
|
||||
// TODO initilize 'total' to zero and 'hand' to an empty List
|
||||
}
|
||||
|
||||
public void setCurrentBet(int currentBet) {
|
||||
this.currentBet = currentBet;
|
||||
@@ -14,6 +20,9 @@ public class Player {
|
||||
return this.currentBet;
|
||||
}
|
||||
|
||||
// TODO replace Player.setTotal with recordWin and recordLoss
|
||||
// recordWin adds 'currentBet' to 'total' and then sets 'currentBet' to zero
|
||||
// recordLoss subtracts 'currentBet' to 'total' and then sets 'currentBet' to zero
|
||||
public void setTotal(int total) {
|
||||
this.total = total;
|
||||
}
|
||||
@@ -22,6 +31,9 @@ public class Player {
|
||||
return this.total;
|
||||
}
|
||||
|
||||
// TODO replace Player.setHand with 'dealCard(Card card)' and resetHand()
|
||||
// dealCard adds the given card to the player's hand
|
||||
// resetHand resets 'hand' to an empty list
|
||||
public void setHand(LinkedList<Card> hand) {
|
||||
this.hand = hand;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user