diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-05-15 19:14:29 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-05-15 19:14:29 +0200 |
| commit | c2f3b1c9c534cadc81ebab3e718832d121cdf9cf (patch) | |
| tree | 458552dfe2e114e4d6dd9aae766855dc6351efbb /cpp | |
| parent | 97ae34da2a51d9bbc13905598ebc80633c3f80c2 (diff) | |
| download | nissy-core-c2f3b1c9c534cadc81ebab3e718832d121cdf9cf.tar.gz nissy-core-c2f3b1c9c534cadc81ebab3e718832d121cdf9cf.zip | |
WASM and JS port - work in progress
Diffstat (limited to '')
| -rw-r--r-- | cpp/nissy.cpp | 14 | ||||
| -rw-r--r-- | cpp/nissy.h | 12 |
2 files changed, 13 insertions, 13 deletions
diff --git a/cpp/nissy.cpp b/cpp/nissy.cpp index 2faea6f..25039bb 100644 --- a/cpp/nissy.cpp +++ b/cpp/nissy.cpp | |||
| @@ -36,9 +36,9 @@ namespace nissy { | |||
| 36 | const nissflag nissflag::ALL{7}; | 36 | const nissflag nissflag::ALL{7}; |
| 37 | 37 | ||
| 38 | const error error::OK{0}; | 38 | const error error::OK{0}; |
| 39 | const error error::UNSOLVABLE{-1}; | 39 | const error error::UNSOLVABLE_WARNING{-1}; |
| 40 | const error error::UNSOLVABLE_ERROR{-11}; | ||
| 40 | const error error::INVALID_CUBE{-10}; | 41 | const error error::INVALID_CUBE{-10}; |
| 41 | const error error::UNSOLVABLE_CUBE{-11}; | ||
| 42 | const error error::INVALID_MOVES{-20}; | 42 | const error error::INVALID_MOVES{-20}; |
| 43 | const error error::INVALID_TRANS{-30}; | 43 | const error error::INVALID_TRANS{-30}; |
| 44 | const error error::INVALID_SOLVER{-50}; | 44 | const error error::INVALID_SOLVER{-50}; |
| @@ -48,12 +48,12 @@ namespace nissy { | |||
| 48 | const error error::OPTIONS{-80}; | 48 | const error error::OPTIONS{-80}; |
| 49 | const error error::UNKNOWN{-999}; | 49 | const error error::UNKNOWN{-999}; |
| 50 | 50 | ||
| 51 | const status status::run{0}; | 51 | const status status::RUN{0}; |
| 52 | const status status::stop{1}; | 52 | const status status::STOP{1}; |
| 53 | const status status::pause{2}; | 53 | const status status::PAUSE{2}; |
| 54 | 54 | ||
| 55 | namespace size { | 55 | namespace size { |
| 56 | constexpr size_t CUBE = 22; | 56 | constexpr size_t CUBE = 24; |
| 57 | constexpr size_t TRANSFORMATION = 12; | 57 | constexpr size_t TRANSFORMATION = 12; |
| 58 | constexpr size_t DATAID = 255; | 58 | constexpr size_t DATAID = 255; |
| 59 | } | 59 | } |
| @@ -160,7 +160,7 @@ namespace nissy { | |||
| 160 | solver::solve(const cube& cube, nissflag niss, unsigned minmoves, | 160 | solver::solve(const cube& cube, nissflag niss, unsigned minmoves, |
| 161 | unsigned maxmoves, unsigned maxsols, unsigned optimal, | 161 | unsigned maxmoves, unsigned maxsols, unsigned optimal, |
| 162 | unsigned threads, int (*poll_status)(void *), | 162 | unsigned threads, int (*poll_status)(void *), |
| 163 | void *poll_status_data) | 163 | void *poll_status_data) const |
| 164 | { | 164 | { |
| 165 | solver::solve_result result; | 165 | solver::solve_result result; |
| 166 | 166 | ||
diff --git a/cpp/nissy.h b/cpp/nissy.h index 41d3876..884043d 100644 --- a/cpp/nissy.h +++ b/cpp/nissy.h | |||
| @@ -33,9 +33,9 @@ namespace nissy { | |||
| 33 | bool ok() const; | 33 | bool ok() const; |
| 34 | 34 | ||
| 35 | static const error OK; | 35 | static const error OK; |
| 36 | static const error UNSOLVABLE; | 36 | static const error UNSOLVABLE_WARNING; |
| 37 | static const error UNSOLVABLE_ERROR; | ||
| 37 | static const error INVALID_CUBE; | 38 | static const error INVALID_CUBE; |
| 38 | static const error UNSOLVABLE_CUBE; | ||
| 39 | static const error INVALID_MOVES; | 39 | static const error INVALID_MOVES; |
| 40 | static const error INVALID_TRANS; | 40 | static const error INVALID_TRANS; |
| 41 | static const error INVALID_SOLVER; | 41 | static const error INVALID_SOLVER; |
| @@ -50,9 +50,9 @@ namespace nissy { | |||
| 50 | public: | 50 | public: |
| 51 | int value; | 51 | int value; |
| 52 | 52 | ||
| 53 | static const status run; | 53 | static const status RUN; |
| 54 | static const status stop; | 54 | static const status STOP; |
| 55 | static const status pause; | 55 | static const status PAUSE; |
| 56 | }; | 56 | }; |
| 57 | 57 | ||
| 58 | class cube { | 58 | class cube { |
| @@ -96,7 +96,7 @@ namespace nissy { | |||
| 96 | solve_result solve(const cube&, nissflag, unsigned minmoves, | 96 | solve_result solve(const cube&, nissflag, unsigned minmoves, |
| 97 | unsigned maxmoves, unsigned maxsols, unsigned optimal, | 97 | unsigned maxmoves, unsigned maxsols, unsigned optimal, |
| 98 | unsigned threads, int (*poll_status)(void *), | 98 | unsigned threads, int (*poll_status)(void *), |
| 99 | void *poll_status_data); | 99 | void *poll_status_data) const; |
| 100 | 100 | ||
| 101 | static std::variant<solver, error> get(const std::string&); | 101 | static std::variant<solver, error> get(const std::string&); |
| 102 | private: | 102 | private: |
