-
Notifications
You must be signed in to change notification settings - Fork 0
/
digit_chain.h
68 lines (46 loc) · 1.16 KB
/
digit_chain.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 DIGIT_CHAIN_H
#define DIGIT_CHAIN_H
#include "bits.h"
#include "coords.h"
#include "strong_link.h"
extern const int DC_BLACK;
extern const int DC_WHITE;
class DigitVertex {
public:
DigitVertex();
DigitVertex(Spot _spot, int _color);
void connect(StrongLink& link, int peer);
Spot spot;
int color;
std::vector<int> peers;
std::vector<StrongLink> links;
};
class DigitChain {
public:
DigitChain();
DigitChain(int _val);
DigitChain(int _val, StrongLink& link);
bool has_spot(Spot p);
void add_strong_link(StrongLink& link);
void scan_false_color();
std::vector<Spot> chain_spots();
std::vector<Spot> both_cover(Bits* bits);
int val;
bool black;
bool white;
std::vector<DigitVertex> verts;
};
class DigitChains {
public:
DigitChains();
DigitChains(int _val);
void add_strong_link(StrongLink& link);
void add_links(Bits* bits);
int val;
std::vector<DigitChain> chains;
};
int dc_other_color(int color);
int idx_of_digit_vertex(std::vector<DigitVertex>& verts, Spot p);
DigitChain bridge_digit_chains(DigitChain& dca, DigitChain& dcb, StrongLink& link);
int idx_of_digit_chain(std::vector<DigitChain>& chains, Spot p);
#endif