aboutsummaryrefslogtreecommitdiff
path: root/src/main/api.h
diff options
context:
space:
mode:
authorTom Harley2019-01-24 12:10:15 +0000
committerTom Harley2019-01-24 12:10:15 +0000
commit1ef39e9ba6ce1a622c53f38929d1e77b4f2518fc (patch)
tree7734126b8b4c2bd9f97d45137cf73c83fdf8c829 /src/main/api.h
parentwow a thing that works (diff)
downloadmetasol-1ef39e9ba6ce1a622c53f38929d1e77b4f2518fc.tar.gz
metasol-1ef39e9ba6ce1a622c53f38929d1e77b4f2518fc.zip

It works with fortune’s favor

It seems to be consistently running to completion successfully! It’s been renamed to metasol for now, since that’s a better name than test. Next step will probably be eliminating the namespace pollution in metasol.cpp.

Diffstat (limited to 'src/main/api.h')
-rw-r--r--src/main/api.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main/api.h b/src/main/api.h
index 86e3441..e454816 100644
--- a/src/main/api.h
+++ b/src/main/api.h
@@ -5,6 +5,7 @@
#include "game/move.h"
#include "game/sol_rules.h"
+#include "game/card.h"
// just for now, until I construct my own rules stuff:
#include "input-output/input/json-parsing/rules_parser.h"
@@ -12,9 +13,20 @@
typedef std::vector<std::vector<std::string>> piles;
typedef std::vector<move> movelist;
+enum finished_state {
+ SOLUTION_FOUND, NO_SOLUTION, TIMEOUT, SOLVER_OOM, CANCELLED
+};
+
class game_state {
public:
game_state(const sol_rules&, piles);
+ game_state(const sol_rules&,
+ std::vector<std::vector<card::suit_t>>,
+ std::vector<std::vector<card::rank_t>>,
+ std::vector<std::vector<bool>>);
+
+ bool is_solved() const;
+
enum class streamliner_options {NONE, AUTO_FOUNDATIONS, SUIT_SYMMETRY, BOTH};
void make_move(move);
@@ -62,5 +74,5 @@ class game_state {
*
* Returns true if a solution was found; false otherwise.
*/
-bool get_moves(movelist& moves, game_state& gs, uint64_t cache_capacity,
- uint64_t timeout);
+finished_state get_moves(movelist& moves, game_state& gs,
+ uint64_t cache_capacity, uint64_t timeout);