From c5e5d9d6bbd7d7d2a6c6463505e7b7031e846ebf Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Tue, 24 Oct 2017 01:23:00 +0100 Subject: Draft of OO game logic --- src/main/black_hole_state.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/main/black_hole_state.h (limited to 'src/main/black_hole_state.h') diff --git a/src/main/black_hole_state.h b/src/main/black_hole_state.h new file mode 100644 index 0000000..75fda71 --- /dev/null +++ b/src/main/black_hole_state.h @@ -0,0 +1,36 @@ +// +// Created by thecharlesblake on 10/23/17. +// + +#ifndef SOLVITAIRE_BLACK_HOLE_STATE_H +#define SOLVITAIRE_BLACK_HOLE_STATE_H + +#include +#include + +#include + +#include "card.h +#include "game_state.h" + +class black_hole_state : public game_state { +public: + black_hole_state(const rapidjson::Document& doc); + std::vector get_next_legal_states() const override; + bool is_solved() const override; + std::ostream& print(std::ostream&) const override; + + friend std::ostream& operator<< (std::ostream&, const black_hole_state&); + +protected: + virtual static const int MAX_RANK = 13; + +private: + void move_to_hole(int); + static bool adjacent(const card& a, const card& b); + + card hole_card; + mutable bool solved; +}; + +#endif //SOLVITAIRE_BLACK_HOLE_STATE_H -- cgit v1.2.1