From 7b4f42242d277adeaec7a40eaac7d178141d4621 Mon Sep 17 00:00:00 2001 From: Tom Harley Date: Tue, 29 Jan 2019 19:12:22 +0000 Subject: Reorganise submodules (and submodulise solvitaire) The submodules should now point to repos I've made in order to produce static libraries from them. Also, solvitaire now points to a similar personal repo. --- solvitaire | 1 + solvitaire/src/main/api.h | 117 ---------------------------------------------- 2 files changed, 1 insertion(+), 117 deletions(-) create mode 160000 solvitaire delete mode 100644 solvitaire/src/main/api.h (limited to 'solvitaire/src/main/api.h') diff --git a/solvitaire b/solvitaire new file mode 160000 index 0000000..b835e10 --- /dev/null +++ b/solvitaire @@ -0,0 +1 @@ +Subproject commit b835e10bfb21a73b4f89e09ddeb400f415384835 diff --git a/solvitaire/src/main/api.h b/solvitaire/src/main/api.h deleted file mode 100644 index 09b083d..0000000 --- a/solvitaire/src/main/api.h +++ /dev/null @@ -1,117 +0,0 @@ -#include -#include -#include -#include - -#include "game/card.h" -#include "game/move.h" -#include "game/sol_rules.h" - -#ifndef SOLVITAIRE_SOLVER_H -namespace solver { - namespace result { - enum class type { - TIMEOUT, SOLVED, UNSOLVABLE, MEM_LIMIT, TERMINATED - }; - } -} -#endif - -#ifndef SOLVITAIRE_GAME_STATE_H -class game_state { - friend class hasher; - friend class global_cache; - friend class cached_game_state; - friend class deal_parser; - friend class state_printer; - friend class test_helper; - friend class json_helper; -public: - enum class streamliner_options {NONE, AUTO_FOUNDATIONS, SUIT_SYMMETRY, BOTH}; - - /* Constructors */ - - // Creates a game state representation from a JSON doc - game_state(const sol_rules&, const rapidjson::Document&, streamliner_options); - // Does the same from a seed - game_state(const sol_rules&, int seed, streamliner_options); - // Does the same but with an initialiser list (useful for testing) - game_state(const sol_rules&, std::initializer_list>); - // Does the same but with vectors - game_state(const sol_rules&, std::vector>); - // Does the same but with lots of vectors - game_state(const sol_rules&, std::vector>, - std::vector>, - std::vector>); - - /* Altering state */ - - void make_move(move); - void undo_move(move); - void place_card(pile::ref, card); - card take_card(pile::ref); - - /* Legal move generation */ - - std::vector get_legal_moves(move = move(move::mtype::regular)); - boost::optional get_dominance_move() const; - - /* State inspection */ - - bool is_solved() const; - const std::vector& get_data() const; - - /* Printing */ - - friend std::ostream& operator<< (std::ostream&, const game_state&); - -private: - - /* Game rules */ - - const sol_rules rules; - streamliner_options stream_opts; - card::rank_t foundations_base; - - /* Pile references */ - - std::list tableau_piles; - std::list cells; - pile::ref stock; - pile::ref waste; - std::list reserve; - std::vector foundations; - std::vector sequences; - std::list accordion; - pile::ref hole; - - /* Pile references of starting/original layout */ - - std::vector original_tableau_piles; - std::vector original_cells; - std::vector original_reserve; - - /* Auto-foundation moves state */ - - std::vector auto_foundation_moves; - - /* Core piles */ - - std::vector piles; -}; -#endif - -typedef std::vector> piles; -typedef std::vector movelist; - -/** - * Populate a move list with a bunch of moves that lead to a solution. - * - * Clears the list, then, if a solution is found, populates it with the moves - * required to realise the solution. - * - * Returns true if a solution was found; false otherwise. - */ -solver::result::type get_moves(movelist& moves, game_state& gs, - uint64_t cache_capacity, uint64_t timeout); - -- cgit v1.2.1