diff --git a/src/main.rs b/src/main.rs index 3f783d9..c73fc44 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,7 +47,6 @@ fn interactive_play(args: Args) -> anyhow::Result<()> { loop { println!("\nMoney in the bank: ${bank}"); - // TODO: show normalized card count if args.show_count { println!( "Card count: {} ({})", @@ -127,6 +126,7 @@ fn interactive_play_turn( ) -> anyhow::Result> { let mut initial_play = !turn.was_split; let mut other_turn = None; + let mut show_count = args.show_count; let term = Term::stdout(); loop { @@ -138,12 +138,15 @@ fn interactive_play_turn( if turn.shuffled { println!("Deck was shuffled"); } - if args.show_count { + if show_count { println!( "Card count: {} ({})", table.count(), table.count() / args.decks as i16 ); + + // Reset to CLI arg value until user asks again + show_count = args.show_count; } println!("Your bet: ${}", turn.bet); println!("Dealer showing: {}", table.dealer_showing()); @@ -167,6 +170,10 @@ fn interactive_play_turn( if can_split { msg += ", s(p)lit"; } + if !args.show_count { + // Not given via CLI args, so ask user + msg += ", show (c)ount"; + } msg += "? "; io::stdout().write_all(msg.as_bytes())?; io::stdout().flush()?; @@ -191,6 +198,7 @@ fn interactive_play_turn( other_turn = Some(table.split(turn)?); initial_play = false; } + 'c' => show_count = true, _ => {} }; if stop {