aboutsummaryrefslogtreecommitdiff
path: root/src/main/game/global_cache.h
blob: 486006c8c1e1342bd5b7f0efdc4c05705b1accb7 (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
//
// Created by thecharlesblake on 1/10/18.
//

#ifndef SOLVITAIRE_GLOBAL_CACHE_H
#define SOLVITAIRE_GLOBAL_CACHE_H

#include <vector>
#include <unordered_set>

#include <boost/functional/hash.hpp>

#include "sol_rules.h"
#include "game_state.h"

struct game_state_pred {
    static bool comp_pile(const pile& x, const pile& y);
    bool operator() (const game_state& x, const game_state& y)
    const;
};

class global_cache {
public:
    bool insert(const game_state&);
    bool contains(const game_state&) const;
    void clear();
private:
    std::unordered_set<
            game_state,
            boost::hash<game_state>,
            game_state_pred
    > u_set;
};

#endif //SOLVITAIRE_GLOBAL_CACHE_H