From 92da37d0d58679a4b28c8f2145b84dc028ee0543 Mon Sep 17 00:00:00 2001 From: Dave Burke Date: Fri, 21 Jan 2022 13:00:58 -0600 Subject: [PATCH] Prompt for bets and add notes on classes --- 10_Blackjack/java/src/Blackjack.java | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/10_Blackjack/java/src/Blackjack.java b/10_Blackjack/java/src/Blackjack.java index e8d33be9..74d11dd1 100644 --- a/10_Blackjack/java/src/Blackjack.java +++ b/10_Blackjack/java/src/Blackjack.java @@ -18,7 +18,32 @@ public class Blackjack { } int nPlayers = promptInt("NUMBER OF PLAYERS ", 1, 7); - System.out.println("You picked " + nPlayers); + + System.out.println("BETS: "); + for(int i = 1; i <= nPlayers; i++) { + // TODO that this will repeat the individual player's prompt if the number is out of range. + // The original BASIC code accepts all bets, then validates them together and prompts all + // players again if any inputs are invalid. This should be updated to behave like the original. + promptInt("#" + i, 1, 500); + } + + /* + Note that LinkedList is a Deque: https://docs.oracle.com/javase/8/docs/api/java/util/Deque.html + Player + CurrentBet + Total + Hand + Hand + cards LinkedList + evaluate() // see 300 in blackjack.bas for eval subroutine logic + Deck // note the game is played with more than one deck + cards LinkedList // instantiate cards and randomize in constructor via Collections.shuffle() + List dealHands(n) + discardPile Queue + Card + Value + Suit + */ } /**