-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHand.h
More file actions
36 lines (27 loc) · 1021 Bytes
/
Hand.h
File metadata and controls
36 lines (27 loc) · 1021 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef HAND_H
#define HAND_H
#include "Card.h"
class Hand {
// OVERVIEW: A blackjack hand of zero or more cards
// Note: this really is the only private state you need!
int value; // value of hand
bool soft; // true if hand value is a soft count
public:
Hand();
// EFFECTS: establishes an empty blackjack hand.
void discard_all();
// MODIFIES: this
// EFFECTS: discards any cards presently held, restoring the state
// of the hand to that of an empty blackjack hand.
void add_card(Card c);
// MODIFIES: this
// EFFECTS: adds the card "c" to those presently held.
int hand_value() const;
// EFFECTS: returns the present value of the blackjack hand, the
// highest blackjack total possible without going over 21. If the hand is
// over 21, any value over 21 may be returned.
bool hand_is_soft() const;
// EFFECTS: return true if and only if at least one ACE is present, and
// its value is counted as 11 rather than 1.
};
#endif