-
Notifications
You must be signed in to change notification settings - Fork 0
/
color_maps.hpp
68 lines (63 loc) · 1.43 KB
/
color_maps.hpp
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
#pragma once
// return random colors
template <typename varTyp> struct Color_map {
virtual int r(varTyp value) { return (2500 + 500 * value) % 65535; }
virtual int g(varTyp value) { return (10408 + 500 * value) % 65535; }
virtual int b(varTyp value) { return (7401 + 500 * value) % 65535; }
};
template <typename varTyp> struct Black_white_map : Color_map<varTyp> {
int r(varTyp value) { return value ? 65535 : 0; }
int g(varTyp value) { return value ? 65535 : 0; }
int b(varTyp value) { return value ? 65535 : 0; }
};
// return 4 colors:
// white (11) == alive
// black ( 0) == dead
// green (10) == should be alive
// red ( 1) == should be dead
// function to determine the state of a cell: solution[i] * 10 + result[i]
// -> a dead cell is stored with 0 and a living cell with 1
struct Ghost_diff_map : Color_map<int> {
int r(int value) {
switch (value) {
case 0:
return 0;
case 11:
return 65535;
case 1:
return 65535;
case 10:
return 0;
default:
return 20000;
}
}
int g(int value) {
switch (value) {
case 0:
return 0;
case 11:
return 65535;
case 1:
return 0;
case 10:
return 65535;
default:
return 20000;
}
}
int b(int value) {
switch (value) {
case 0:
return 0;
case 11:
return 65535;
case 1:
return 0;
case 10:
return 0;
default:
return 20000;
}
}
};