-
Notifications
You must be signed in to change notification settings - Fork 2
/
pattern.h
68 lines (60 loc) · 1.79 KB
/
pattern.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
#ifndef IKOOSKAR_SHARED_PATTERN_H
#define IKOOSKAR_SHARED_PATTERN_H
#include <QHash>
#include <QList>
namespace ikoOSKAR {
namespace Shared {
class Pattern {
public:
enum Variant {
a = 0,
b,
c,
d
};
Pattern(int gradeCount, int seed);
static Pattern* random(int gradeCount);
Variant variantAt(int row, int col);
private:
int gradeIndex; // gradeIndex = gradeCount - 1
int startOffset;
// clang-format off
const static inline Variant patterns[4][6][6] = {
{ // 1-variant pattern
{ a, a, a, a, a, a },
{ a, a, a, a, a, a },
{ a, a, a, a, a, a },
{ a, a, a, a, a, a },
{ a, a, a, a, a, a },
{ a, a, a, a, a, a }
},
{ // 2-variant pattern
{ a, b, a, b, a, b },
{ a, b, a, b, a, b },
{ a, b, a, b, a, b },
{ a, b, a, b, a, b },
{ a, b, a, b, a, b },
{ a, b, a, b, a, b }
},
{ // 3-variant pattern
{ a, b, a, b, a, b },
{ a, c, a, c, a, c },
{ b, c, b, c, b, c },
{ b, a, b, a, b, a },
{ c, a, c, a, c, a },
{ c, b, c, b, c, b }
},
{ // 4-variant pattern
{ a, b, c, d, a, b },
{ c, d, a, b, c, d },
{ a, b, c, d, a, b },
{ c, d, a, b, c, d },
{ a, b, c, d, a, b },
{ c, d, a, b, c, d }
}
};
// clang-format on
};
} // namespace Shared
} // namespace ikoOSKAR
#endif // IKOOSKAR_SHARED_PATTERN_H