baba-is-auto
C++17 Baba Is You simulator
Loading...
Searching...
No Matches
Game.hpp
Go to the documentation of this file.
1// Copyright (c) 2020-2026 Chris Ohk
2
3// I am making my contributions/submissions to this project solely in our
4// personal capacity and am not conveying any rights to any intellectual
5// property of any third parties.
6
7#ifndef BABA_IS_AUTO_GAME_HPP
8#define BABA_IS_AUTO_GAME_HPP
9
13
14#include <string>
15#include <vector>
16
17namespace baba_is_auto
18{
24class Game
25{
26 public:
29 explicit Game(std::string_view filename);
30
32 void Reset();
33
37
40 const Map& GetMap() const;
41
45
49
53
57
58 private:
60 void ParseRules();
61
66 void ParseRule(std::size_t x, std::size_t y, RuleDirection direction);
67
73 bool CanMove(std::size_t x, std::size_t y, Direction dir);
74
80 void ProcessMove(std::size_t x, std::size_t y, Direction dir,
81 const std::vector<ObjectType>& types);
82
84 void ProcessPush(std::size_t x, std::size_t y, Direction dir);
85
87 void CheckPlayState();
88
89 Map m_map;
90 RuleManager m_ruleManager;
91
92 PlayState m_playState = PlayState::INVALID;
93 ObjectType m_playerIcon = ObjectType::ICON_EMPTY;
94 std::vector<ObjectType> m_playerIcons;
95};
96} // namespace baba_is_auto
97
98#endif
Game class.
Definition Game.hpp:25
void MovePlayer(Direction dir)
Game(std::string_view filename)
void Reset()
Resets map and rule data.
RuleManager & GetRuleManager()
ObjectType GetPlayerIcon() const
const Map & GetMap() const
PlayState GetPlayState() const
Map class.
Definition Map.hpp:27
RuleManager class.
Definition RuleManager.hpp:22
Definition IAgent.hpp:14
RuleDirection
An enumerator for identifying the direction of rule.
Definition RuleEnums.hpp:14
ObjectType
An enumerator for identifying the object.
Definition GameEnums.hpp:14
PlayState
An enumerator for identifying the play state.
Definition GameEnums.hpp:110
Direction
An enumerator for identifying the direction.
Definition GameEnums.hpp:119