From c2f3b1c9c534cadc81ebab3e718832d121cdf9cf Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Thu, 15 May 2025 19:14:29 +0200 Subject: WASM and JS port - work in progress --- cpp/nissy.cpp | 14 +++++++------- cpp/nissy.h | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'cpp') 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 { const nissflag nissflag::ALL{7}; const error error::OK{0}; - const error error::UNSOLVABLE{-1}; + const error error::UNSOLVABLE_WARNING{-1}; + const error error::UNSOLVABLE_ERROR{-11}; const error error::INVALID_CUBE{-10}; - const error error::UNSOLVABLE_CUBE{-11}; const error error::INVALID_MOVES{-20}; const error error::INVALID_TRANS{-30}; const error error::INVALID_SOLVER{-50}; @@ -48,12 +48,12 @@ namespace nissy { const error error::OPTIONS{-80}; const error error::UNKNOWN{-999}; - const status status::run{0}; - const status status::stop{1}; - const status status::pause{2}; + const status status::RUN{0}; + const status status::STOP{1}; + const status status::PAUSE{2}; namespace size { - constexpr size_t CUBE = 22; + constexpr size_t CUBE = 24; constexpr size_t TRANSFORMATION = 12; constexpr size_t DATAID = 255; } @@ -160,7 +160,7 @@ namespace nissy { solver::solve(const cube& cube, nissflag niss, unsigned minmoves, unsigned maxmoves, unsigned maxsols, unsigned optimal, unsigned threads, int (*poll_status)(void *), - void *poll_status_data) + void *poll_status_data) const { solver::solve_result result; 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 { bool ok() const; static const error OK; - static const error UNSOLVABLE; + static const error UNSOLVABLE_WARNING; + static const error UNSOLVABLE_ERROR; static const error INVALID_CUBE; - static const error UNSOLVABLE_CUBE; static const error INVALID_MOVES; static const error INVALID_TRANS; static const error INVALID_SOLVER; @@ -50,9 +50,9 @@ namespace nissy { public: int value; - static const status run; - static const status stop; - static const status pause; + static const status RUN; + static const status STOP; + static const status PAUSE; }; class cube { @@ -96,7 +96,7 @@ namespace nissy { solve_result solve(const cube&, nissflag, unsigned minmoves, unsigned maxmoves, unsigned maxsols, unsigned optimal, unsigned threads, int (*poll_status)(void *), - void *poll_status_data); + void *poll_status_data) const; static std::variant get(const std::string&); private: -- cgit v1.3