@@ -251,16 +251,16 @@ int Blackjack::read_arranged_cards(std::istringstream iss) {
251251
252252void Blackjack::can_double_split (void ) {
253253 int n_cards = playerStats.currentHand ->cards .size ();
254- player->canDouble = (n_cards == 2 );
254+ player->can_double = (n_cards == 2 );
255255 if (das == false ) {
256- player->canDouble &= (playerStats.splits == 0 );
256+ player->can_double &= (playerStats.splits == 0 );
257257 }
258258 if (doa == false ) {
259259 int value = playerStats.currentHand ->value ();
260- player->canDouble &= (value == 9 || value == 10 || value == 11 );
260+ player->can_double &= (value == 9 || value == 10 || value == 11 );
261261 }
262262
263- player->canSplit = n_cards == 2 && (card[*(playerStats.currentHand ->cards .begin ())].value == card[*(++playerStats.currentHand ->cards .begin ())].value );
263+ player->can_split = n_cards == 2 && (card[*(playerStats.currentHand ->cards .begin ())].value == card[*(++playerStats.currentHand ->cards .begin ())].value );
264264 return ;
265265}
266266
@@ -361,12 +361,12 @@ void Blackjack::deal(void) {
361361#ifdef BJDEBUG
362362 std::cout << " up card " << card[dealer_up_card].utf8 () << std::endl;
363363#endif
364- player->dealerValue = hand.value ();
364+ player->value_dealer = hand.value ();
365365
366366 // step 5. deal the second card to each player
367367 player_second_card = draw (&(*playerStats.currentHand ));
368368 info (lbj::Info::CardPlayer, player_second_card);
369- player->playerValue = playerStats.currentHand ->value ();
369+ player->value_player = playerStats.currentHand ->value ();
370370#ifdef BJDEBUG
371371 std::cout << " second card " << card[player_second_card].utf8 () << std::endl;
372372#endif
@@ -400,14 +400,14 @@ void Blackjack::deal(void) {
400400 }
401401
402402 // step 7.b. if either the dealer or the player has a chance to have a blackjack, check
403- if ((card[dealer_up_card].value == 10 || card[dealer_up_card].value == 11 ) || std::abs (player->playerValue ) == 21 ) {
403+ if ((card[dealer_up_card].value == 10 || card[dealer_up_card].value == 11 ) || std::abs (player->value_player ) == 21 ) {
404404 player->actionRequired = lbj::PlayerActionRequired::None;
405405 nextAction = lbj::DealerAction::CheckforBlackjacks;
406406 return ;
407407 }
408408 } else {
409409 // in ENHC, if the player has 21..
410- if (player->playerValue == -21 ) {
410+ if (player->value_player == -21 ) {
411411 if (card[dealer_up_card].value == 10 || card[dealer_up_card].value == 11 ) {
412412 // and the dealer shows an ace or a face she has to draw
413413 // (actually she should ask for insurance)
@@ -519,13 +519,13 @@ void Blackjack::deal(void) {
519519 // see if we finished all the player's hands
520520 if (++playerStats.currentHand != playerStats.hands .end ()) {
521521 unsigned int playerCard = draw (&(*playerStats.currentHand ));
522- player->playerValue = playerStats.currentHand ->value ();
522+ player->value_player = playerStats.currentHand ->value ();
523523 info (lbj::Info::CardPlayer, playerCard, playerStats.currentHand ->id );
524524#ifdef BJDEBUG
525525 std::cout << " card player " << card[playerCard].utf8 () << std::endl;
526526#endif
527527
528- if (std::abs (player->playerValue ) == 21 ) {
528+ if (std::abs (player->value_player ) == 21 ) {
529529 player->actionRequired = lbj::PlayerActionRequired::None;
530530 nextAction = lbj::DealerAction::MoveOnToNextHand;
531531 return ;
@@ -575,14 +575,14 @@ void Blackjack::deal(void) {
575575 }
576576
577577 // hit while count is less than 17 (or equal to soft 17 if hit_soft_17 is true)
578- player->dealerValue = hand.value ();
579- while ((std::abs (player->dealerValue ) < 17 || (h17 && player->dealerValue == -17 )) && hand.busted () == 0 ) {
578+ player->value_dealer = hand.value ();
579+ while ((std::abs (player->value_dealer ) < 17 || (h17 && player->value_dealer == -17 )) && hand.busted () == 0 ) {
580580 unsigned int dealerCard = draw (&hand);
581581 info (lbj::Info::CardDealer, dealerCard);
582582#ifdef BJDEBUG
583583 std::cout << " dealer " << card[dealerCard].utf8 () << std::endl;
584584#endif
585- player->dealerValue = hand.value ();
585+ player->value_dealer = hand.value ();
586586 }
587587
588588 if (enhc == true && hand.blackjack ()) {
@@ -614,7 +614,7 @@ void Blackjack::deal(void) {
614614 }
615615
616616 if (hand.busted ()) {
617- info (lbj::Info::DealerBusts, player->dealerValue );
617+ info (lbj::Info::DealerBusts, player->value_dealer );
618618 playerStats.bustsDealer ++;
619619 for (auto playerHand : playerStats.hands ) {
620620 if (playerHand.busted () == false ) {
@@ -630,15 +630,15 @@ void Blackjack::deal(void) {
630630 } else {
631631 for (auto playerHand : playerStats.hands ) {
632632 if (playerHand.busted () == false ) { // busted hands have already been solved
633- player->playerValue = playerHand.value ();
633+ player->value_player = playerHand.value ();
634634
635- if (std::abs (player->dealerValue ) > std::abs (player->playerValue )) {
635+ if (std::abs (player->value_dealer ) > std::abs (player->value_player )) {
636636
637637 playerStats.currentOutcome -= playerHand.bet ;
638- info (lbj::Info::PlayerLosses, 1e3 *playerHand.bet , player->playerValue );
638+ info (lbj::Info::PlayerLosses, 1e3 *playerHand.bet , player->value_player );
639639 playerStats.losses ++;
640640
641- } else if (std::abs (player->dealerValue ) == std::abs (player->playerValue )) {
641+ } else if (std::abs (player->value_dealer ) == std::abs (player->value_player )) {
642642
643643 // give him his (her her) money back
644644 playerStats.bankroll += playerHand.bet ;
@@ -650,7 +650,7 @@ void Blackjack::deal(void) {
650650 // pay him (her)
651651 playerStats.bankroll += 2 * playerHand.bet ;
652652 playerStats.currentOutcome += playerHand.bet ;
653- info (lbj::Info::PlayerWins, 1e3 *playerHand.bet , player->playerValue );
653+ info (lbj::Info::PlayerWins, 1e3 *playerHand.bet , player->value_player );
654654 playerStats.wins ++;
655655 playerStats.winsDoubled += playerHand.doubled ;
656656
@@ -719,20 +719,20 @@ int Blackjack::process(void) {
719719 // if we made it this far, the command is particular
720720 case lbj::PlayerActionTaken::Bet:
721721 // TODO: bet = 0 -> wonging
722- if (player->currentBet == 0 ) {
723- info (lbj::Info::BetInvalid, player->currentBet );
722+ if (player->current_bet == 0 ) {
723+ info (lbj::Info::BetInvalid, player->current_bet );
724724 return 0 ;
725- } else if (player->currentBet < 0 ) {
726- info (lbj::Info::BetInvalid, player->currentBet );
725+ } else if (player->current_bet < 0 ) {
726+ info (lbj::Info::BetInvalid, player->current_bet );
727727 return 0 ;
728- } else if (max_bet != 0 && player->currentBet > max_bet) {
729- info (lbj::Info::BetInvalid, player->currentBet );
728+ } else if (max_bet != 0 && player->current_bet > max_bet) {
729+ info (lbj::Info::BetInvalid, player->current_bet );
730730 return 0 ;
731731 } else {
732732
733733 // ok, valid bet, copy the player's bet and use the local copy
734734 // (to prevent cheating players from changing the bet after dealing)
735- playerStats.currentHand ->bet = player->currentBet ;
735+ playerStats.currentHand ->bet = player->current_bet ;
736736
737737 // and take his (her) money
738738 playerStats.bankroll -= playerStats.currentHand ->bet ;
@@ -792,7 +792,7 @@ int Blackjack::process(void) {
792792// /ip+double+detail This command can be abbreviated as `d`.
793793 case lbj::PlayerActionTaken::Double:
794794 can_double_split ();
795- if (player->canDouble == true ) {
795+ if (player->can_double == true ) {
796796
797797 // TODO: check bankroll
798798 // take his (her) money
@@ -807,11 +807,11 @@ int Blackjack::process(void) {
807807 playerStats.handsDoubled ++;
808808
809809 playerCard = draw (&(*playerStats.currentHand ));
810- player->playerValue = playerStats.currentHand ->value ();
810+ player->value_player = playerStats.currentHand ->value ();
811811 info (lbj::Info::CardPlayer, playerCard, playerStats.currentHand ->id );
812812
813813 if (playerStats.currentHand ->busted ()) {
814- info (lbj::Info::PlayerLosses, 1e3 *playerStats.currentHand ->bet , player->playerValue );
814+ info (lbj::Info::PlayerLosses, 1e3 *playerStats.currentHand ->bet , player->value_player );
815815 playerStats.currentOutcome -= playerStats.currentHand ->bet ;
816816 playerStats.bustsPlayer ++;
817817 playerStats.losses ++;
@@ -882,7 +882,7 @@ int Blackjack::process(void) {
882882
883883 // deal a card to the first hand
884884 playerCard = draw (&(*playerStats.currentHand ));
885- player->playerValue = playerStats.currentHand ->value ();
885+ player->value_player = playerStats.currentHand ->value ();
886886 info (lbj::Info::CardPlayer, playerCard, playerStats.currentHand ->id );
887887
888888 // aces get dealt only one card
@@ -891,7 +891,7 @@ int Blackjack::process(void) {
891891 if (++playerStats.currentHand != playerStats.hands .end ()) {
892892 info (lbj::Info::PlayerNextHand, (*playerStats.currentHand ).id );
893893 playerCard = draw (&(*playerStats.currentHand ));
894- player->playerValue = playerStats.currentHand ->value ();
894+ player->value_player = playerStats.currentHand ->value ();
895895 info (lbj::Info::CardPlayer, playerCard, playerStats.currentHand ->id );
896896
897897 // if the player got an ace or 21 again, we are done
@@ -930,7 +930,7 @@ int Blackjack::process(void) {
930930// /ip+hit+detail
931931// /ip+hit+detail This command can be abbreviated as `h`.
932932 playerCard = draw (&(*playerStats.currentHand ));
933- player->playerValue = playerStats.currentHand ->value ();
933+ player->value_player = playerStats.currentHand ->value ();
934934 info (lbj::Info::CardPlayer, playerCard, playerStats.currentHand ->id );
935935
936936 if (playerStats.currentHand ->busted ()) {
0 commit comments