forked from jamesfowkes/cryptology-dice-display
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dice.cpp
62 lines (58 loc) · 977 Bytes
/
dice.cpp
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
#include <stdint.h>
static const bool NUMBERS_TO_PIXEL_MAP[10][9] = {
{
false, false, false,
false, false, false,
false, false, false
}, //0
{
false, false, false,
false, true, false,
false, false, false
}, //1
{
true, false, false,
false, false, false,
false, false, true
}, //2
{
false, false, true,
false, true, false,
true, false, false
}, //3
{
true, false, true,
false, false, false,
true, false, true
}, //4
{
true, false, true,
false, true, false,
true, false, true
}, //5
{
true, false, true,
true, false, true,
true, false, true
}, //6
{
true, false, true,
true, true, true,
true, false, true
}, //7
{
true, true, true,
true, false, true,
true, true, true
}, //8
{
true, true, true,
true, true, true,
true, true, true
}, //9
};
bool pixel_is_on(uint8_t number, uint8_t px)
{
if ((number > 9) || (px >= 9)) { return false; }
return NUMBERS_TO_PIXEL_MAP[number][px];
}