ttt_meta.h 925 B

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // Created by nositelshtanov on 11/11/2023.
  3. //
  4. #ifndef TTT_TTT_META_H
  5. #define TTT_TTT_META_H
  6. #include "ttt_engine.h"
  7. class ttt_meta: public ttt_engine {
  8. public:
  9. enum {
  10. map_size = 9,
  11. any_map = map_size
  12. };
  13. using ttt_meta_map = std::array<ttt_engine, map_size>;
  14. explicit ttt_meta(mark whose_step_first) : whose_step(whose_step_first), next_map(any_map) {}
  15. ttt_meta() : ttt_meta(mark::cross) {}
  16. mark get_mark(std::size_t map_number, std::size_t field) const { return map[map_number].get_mark(field); }
  17. const ttt_engine& get_mark(std::size_t map_number) const { return map[map_number]; }
  18. mark get_whose_step() const { return whose_step; }
  19. void step(std::size_t map_number, std::size_t field);
  20. std::size_t get_next_map_number() const { return next_map; }
  21. private:
  22. ttt_meta_map map;
  23. mark whose_step;
  24. std::size_t next_map;
  25. };
  26. #endif //TTT_TTT_META_H