Kaynağa Gözat

no need for dealer hand

master
gtheler 5 yıl önce
ebeveyn
işleme
5ec84f2f37
2 değiştirilmiş dosya ile 2 ekleme ve 11 silme
  1. +2
    -8
      src/base.h
  2. +0
    -3
      src/blackjack.cpp

+ 2
- 8
src/base.h Dosyayı Görüntüle

bool doubled = false; bool doubled = false;
}; };


class DealerHand : public Hand {
public:
bool holeCardShown = false;
};


class Player { class Player {
public: public:
Player() = default; Player() = default;
std::list<PlayerHand> hands; std::list<PlayerHand> hands;
std::list<PlayerHand>::iterator currentHand; std::list<PlayerHand>::iterator currentHand;


DealerHand dealerHand;
Hand dealerHand;
}; };


// TODO: most of the games will have a single element, but maybe // TODO: most of the games will have a single element, but maybe
// there are games where the dealer has more than one hand // there are games where the dealer has more than one hand
// std::list <Hand> hands; // std::list <Hand> hands;
DealerHand hand;
Hand hand;
}; };



+ 0
- 3
src/blackjack.cpp Dosyayı Görüntüle

n_hand++; n_hand++;
// clear dealer's hand // clear dealer's hand
hand.holeCardShown = false;
hand.cards.clear(); hand.cards.clear();


// erase all the player's hands, create one, add and make it the current one // erase all the player's hands, create one, add and make it the current one
if (player->bustedAllHands) { if (player->bustedAllHands) {
std::cout << "player_busted_all_hands" << std::endl; std::cout << "player_busted_all_hands" << std::endl;
std::cout << "card_dealer_hole " << card[holeCard].utf8() << std::endl; std::cout << "card_dealer_hole " << card[holeCard].utf8() << std::endl;
hand.holeCardShown = true;
std::cout << "dealer_hand" << std::endl; std::cout << "dealer_hand" << std::endl;
// TODO: no tengo que sacarle todo el dinero? // TODO: no tengo que sacarle todo el dinero?
case DealerAction::HitDealerHand: case DealerAction::HitDealerHand:
std::cout << "card_dealer_hole" << card[holeCard].utf8() << std::endl; std::cout << "card_dealer_hole" << card[holeCard].utf8() << std::endl;
hand.holeCardShown = true;


// TODO: print "soft" // TODO: print "soft"
std::cout << "dealer_count " << hand.total() << std::endl; std::cout << "dealer_count " << hand.total() << std::endl;

Yükleniyor…
İptal
Kaydet