-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloader.h
executable file
·82 lines (53 loc) · 1.48 KB
/
loader.h
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#pragma once
#include "libxl.h"
#include <map>
#include <string>
#include <vector>
using std::string;
using namespace libxl;
using ReelSet = std::vector<std::vector<int>>;
using PayLines = std::map<int, std::vector<int>>;
struct WinTuple
{
std::vector<int> symbols;
int win = 0;
};
// Loader reads in the symbols, reels, and pays
// from an Excel spreadsheet using libxl
class Loader
{
public:
explicit Loader(string);
// ensure parsheet is logically consistent
bool validate() const;
bool load();
ReelSet getReels() const {
return m_reels;
}
std::vector<string> getSymbols() const {
return m_symbols;
}
PayLines getPaylines() const {
return m_paylines;
}
std::vector<WinTuple> getPays() const {
return m_pays;
}
protected:
void loadPays(Sheet *, int, int);
void loadPaylines(Sheet *, int, int);
void loadSymbols(Sheet *, int, int);
void loadReels(Sheet *, int, int);
// 2D string rep of reels, i.e. { SEV, BAR, CHR }
std::vector<std::vector<string>> m_reels_str;
// 2D numeric rep of reels, i.e. { 3, 8, 1 }
ReelSet m_reels;
// vector of symbol abbreviation i.e. BAR
std::vector<string> m_symbols;
// map of payline number -> shape, like { 1, {-1,0,1}}
PayLines m_paylines;
// 2D list of payout schedule, i.e. { BAR, BAR, BAR, 30}
std::vector<std::vector<string>> m_payout_str;
// Same as above, but map<int award, symbols> i.e. <30, { BAR, BAR, BAR, 30}>
std::vector<WinTuple> m_pays;
};