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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
/*
C++20 header file for nissy.
*/
#ifndef NISSY_H
#define NISSY_H
#include <array>
#include <functional>
#include <optional>
#include <ranges>
#include <string>
#include <string_view>
#include <variant>
#include <vector>
namespace nissy {
class nissflag {
public:
unsigned value;
static const nissflag NORMAL;
static const nissflag INVERSE;
static const nissflag MIXED;
static const nissflag LINEAR;
static const nissflag ALL;
};
class error {
public:
long long value;
bool ok() const;
static const error OK;
static const error UNSOLVABLE_WARNING;
static const error UNSOLVABLE_ERROR;
static const error INVALID_CUBE;
static const error INVALID_MOVES;
static const error INVALID_TRANS;
static const error INVALID_SOLVER;
static const error NULL_POINTER;
static const error BUFFER_SIZE;
static const error DATA;
static const error OPTIONS;
static const error UNKNOWN;
};
class status {
public:
int value;
static const status RUN;
static const status STOP;
static const status PAUSE;
};
class cube {
public:
cube();
error move(const std::string&);
error transform(const std::string&);
void invert();
std::string to_string() const;
static std::variant<cube, error> from_string(
const std::string&);
static std::variant<cube, error> get(long long ep,
long long eo, long long cp, long long co, long long orien);
static std::variant<cube, error> get(long long ep,
long long eo, long long cp, long long co, long long orien,
const std::string& options);
private:
std::string m_str{"ABCDEFGH=ABCDEFGHIJKL=A"};
};
class solver {
public:
struct solve_result {
error err;
std::vector<std::string> solutions;
std::array<long long, 10> stats;
};
const std::string name;
size_t size;
std::string id;
std::vector<std::byte> data;
bool data_checked{false};
error generate_data();
void read_data(std::ifstream&);
error check_data();
void unload_data();
solve_result solve(const cube&, nissflag, unsigned minmoves,
unsigned maxmoves, unsigned maxsols, unsigned optimal,
unsigned threads, int (*poll_status)(void *),
void *poll_status_data) const;
static std::variant<solver, error> get(const std::string&);
private:
solver(const std::string& name);
};
error count_moves(const std::string&);
void set_logger(void (*)(const char *, void *), void *);
}
#endif
|