add card count

This commit is contained in:
Nick Pegg 2025-07-05 20:07:49 -07:00
parent 821d2114d5
commit dfdbf72188
2 changed files with 20 additions and 7 deletions

View file

@ -16,7 +16,6 @@ fn main() {
}
fn interactive_play() {
// TODO: Persist bank between plays
// TODO: Make a way to reset bank
//
let term = Term::stdout();
@ -93,12 +92,13 @@ fn interactive_play() {
}
}
fn interactive_decision(hand: &Hand, dealer_showing: &Card) -> PlayerChoice {
fn interactive_decision(hand: &Hand, dealer_showing: &Card, _count: i16) -> PlayerChoice {
let term = Term::stdout();
term.clear_screen().unwrap();
println!("Dealer showing: {dealer_showing}");
println!("Your hand: {hand}\n");
println!("Your hand: {hand}");
println!();
if hand.value() == 21 {
println!("You have 21, standing.");
@ -127,7 +127,7 @@ fn interactive_decision(hand: &Hand, dealer_showing: &Card) -> PlayerChoice {
choice
}
fn basic_strategy(hand: &Hand, dealer_showing: &Card) -> PlayerChoice {
fn basic_strategy(hand: &Hand, dealer_showing: &Card, _count: i16) -> PlayerChoice {
// Source: https://en.wikipedia.org/wiki/Blackjack#Basic_strategy
let dv = u8::from(dealer_showing);
let can_dd = hand.cards().len() == 2;