// GameState.h #ifndef GAMESTATE_HPP #define GAMESTATE_HPP #include #include #include "botinterface.hpp" #include "common.hpp" #include "snake.hpp" #include "playerinterface.hpp" const int kUnitSpeed = 1; class GameEngine { public: GameEngine(); void Start(void); void Reset(void); sf::Vector2f GetGameBoundaries(void); struct GameState { unsigned char m_bIsGameOver : 1 = 0; unsigned char m_bIsBotControlled : 1 = 0; unsigned char m_bNoDisplay : 1 = 0; unsigned char m_bSmart : 1 = 0; unsigned char m_bSkipIterations : 1 = 0; unsigned char _5 : 1 = 0; unsigned char _6 : 1 = 0; unsigned char _7 : 1 = 0; } state; std::vector< std::vector > gameBoard; PlayerDirection GetCurrentDirection(void); int GetPlayerSize(void); sf::Vector2f GetHeadLocation(void); sf::Vector2f GetFoodLocation(void); private: PlayerOutput graphics; Snake player; Food playerFood; AISnake bot; void Loop(void); sf::Vector2f MovePlayer(void); void PlaceNewSnakePart(sf::Vector2f location); void RegenerateFood(void); void PrepareGameBoard(void); void UpdatePlayerSpeed(); }; inline std::unique_ptr g_pEngine; #endif