blob: 654f5be85464042e046dc0faa6971bf9983a6006 (
plain) (
blame)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
//
// Created by thecharlesblake on 10/28/17.
//
#ifndef SOLVITAIRE_PILE_H
#define SOLVITAIRE_PILE_H
#include <vector>
#include <iterator>
#include "sol_rules.h"
#include "card.h"
class pile {
friend class hasher;
friend class game_state;
friend class cached_game_state;
public:
typedef uint8_t size_type;
const static size_type max_size_type;
pile() = default;
pile(std::vector<card>);
pile(std::initializer_list<card>);
// Inspect
card top_card() const;
bool empty() const;
size_type size() const;
// Indexes the vector, with the top card as index 0
card& operator[] (size_type);
card operator[] (size_type) const;
friend bool operator==(const pile&, const pile&);
friend bool operator<(const pile&, const pile&);
friend bool operator>(const pile&, const pile&);
friend bool operator<=(const pile&, const pile&);
friend bool operator>=(const pile&, const pile&);
private:
// Modify
void place(card);
card take();
// Underlying vector
std::vector<card> pile_vec;
};
#endif //SOLVITAIRE_PILE_H
|