#include <GameModel.h>
Public Member Functions | |
| Environment (communication::messages::broadcast::MatchConfig matchConfig, const communication::messages::request::TeamConfig &teamConfig1, const communication::messages::request::TeamConfig &teamConfig2, communication::messages::request::TeamFormation teamFormation1, communication::messages::request::TeamFormation teamFormation2) | |
| Environment (Config config, std::shared_ptr< Team > team1, std::shared_ptr< Team > team2) | |
| Environment (Config config, std::shared_ptr< Team > team1, std::shared_ptr< Team > team2, std::shared_ptr< Quaffle > quaffle, std::shared_ptr< Snitch > snitch, std::array< std::shared_ptr< Bludger >, 2 > bludgers, std::deque< std::shared_ptr< CubeOfShit >> pileOfShit) | |
| bool | operator== (const Environment &other) const | 
| bool | operator!= (const Environment &other) const | 
| auto | arePlayerInSameTeam (const std::shared_ptr< const Player > &p1, const std::shared_ptr< const Player > &p2) const -> bool | 
| auto | isPlayerInOwnRestrictedZone (const std::shared_ptr< const Player > &player) const -> bool | 
| auto | isPlayerInOpponentRestrictedZone (const std::shared_ptr< const Player > &player) const -> bool | 
| auto | getAllPlayers () const -> std::array< std::shared_ptr< Player >, 14 > | 
| auto | getTeamMates (const std::shared_ptr< const Player > &player) const -> std::array< std::shared_ptr< Player >, 6 > | 
| auto | getOpponents (const std::shared_ptr< const Player > &player) const -> std::array< std::shared_ptr< Player >, 7 > | 
| bool | cellIsFree (const Position &position) const | 
| auto | getAllFreeCellsAround (const Position &position) const -> std::vector< Position > | 
| auto | getAllLegalCellsAround (const Position &position, bool leftTeam) const -> std::vector< Position > | 
| auto | getAllEmptyCellsAround (const Position &position) const -> std::vector< Position > | 
| auto | getPlayer (const Position &position) const -> std::optional< std::shared_ptr< Player >> | 
| auto | getPlayerById (communication::messages::types::EntityId id) const -> std::shared_ptr< Player > | 
| auto | getTeam (const std::shared_ptr< const Player > &player) const -> std::shared_ptr< Team > | 
| auto | getTeam (TeamSide side) const -> std::shared_ptr< Team > | 
| auto | getAllFreeCells () const -> std::vector< Position > | 
| void | placePlayerOnRandomFreeCell (const std::shared_ptr< Player > &player) | 
| auto | getBallByID (const communication::messages::types::EntityId &id) const -> std::shared_ptr< Ball > | 
| void | removeDeprecatedShit () | 
| void | removeShitOnCell (const Position &position) | 
| auto | isShitOnCell (const Position &position) const -> bool | 
| auto | clone () const -> std::shared_ptr< Environment > | 
| auto | getFreeCellsForRedeploy (const gameModel::TeamSide &teamSide) const -> const std::vector< gameModel::Position > | 
Static Public Member Functions | |
| static Cell | getCell (int x, int y) | 
| static Cell | getCell (const Position &position) | 
| static auto | getSurroundingPositions (const Position &position) -> std::vector< Position > | 
| static auto | getGoalsLeft () -> std::array< Position, 3 > | 
| static auto | getGoalsRight () -> std::array< Position, 3 > | 
| static auto | isGoalCell (const Position &pos) -> bool | 
| static auto | getAllValidCells () -> std::array< Position, 193 > | 
Data Fields | |
| Config | config | 
| std::shared_ptr< Team > | team1 | 
| std::shared_ptr< Team > | team2 | 
| std::shared_ptr< Quaffle > | quaffle | 
| std::shared_ptr< Snitch > | snitch | 
| 
std::array< std::shared_ptr < Bludger >, 2 >  | bludgers | 
| 
std::deque< std::shared_ptr < CubeOfShit > >  | pileOfShit | 
Represents a game state
| gameModel::Environment::Environment | ( | communication::messages::broadcast::MatchConfig | matchConfig, | 
| const communication::messages::request::TeamConfig & | teamConfig1, | ||
| const communication::messages::request::TeamConfig & | teamConfig2, | ||
| communication::messages::request::TeamFormation | teamFormation1, | ||
| communication::messages::request::TeamFormation | teamFormation2 | ||
| ) | 
Constructs an Environment from server config types
| matchConfig | |
| teamConfig | |
| teamFormation | 
| gameModel::Environment::Environment | ( | Config | config, | 
| std::shared_ptr< Team > | team1, | ||
| std::shared_ptr< Team > | team2 | ||
| ) | 
Automatically places all balls at the correct location
| config | |
| team1 | |
| team2 | 
| gameModel::Environment::Environment | ( | Config | config, | 
| std::shared_ptr< Team > | team1, | ||
| std::shared_ptr< Team > | team2, | ||
| std::shared_ptr< Quaffle > | quaffle, | ||
| std::shared_ptr< Snitch > | snitch, | ||
| std::array< std::shared_ptr< Bludger >, 2 > | bludgers, | ||
| std::deque< std::shared_ptr< CubeOfShit >> | pileOfShit | ||
| ) | 
Ctor where all members can be specified
| config | |
| team1 | |
| team2 | |
| quaffle | |
| snitch | |
| bludgers | |
| pileOfShit | 
| auto gameModel::Environment::arePlayerInSameTeam | ( | const std::shared_ptr< const Player > & | p1, | 
| const std::shared_ptr< const Player > & | p2 | ||
| ) | const -> bool | 
tests if two players are in the same team.
| p1 | player 1. | 
| p2 | player 2. | 
| bool gameModel::Environment::cellIsFree | ( | const Position & | position | ) | const | 
| auto gameModel::Environment::clone | ( | ) | const -> std::shared_ptr<Environment> | 
returns a deep copy of the current Environment
| auto gameModel::Environment::getAllFreeCells | ( | ) | const -> std::vector<Position> | 
Gets all valid cells not occupied by players or balls
| auto gameModel::Environment::getAllFreeCellsAround | ( | const Position & | position | ) | const -> std::vector<Position> | 
get all Positions around a given position where no other player or ball is on. If all surrounding cells are blocked the search window is enlarged until a free cell is found
| position | the position to be checked | 
| auto gameModel::Environment::getAllPlayers | ( | ) | const -> std::array<std::shared_ptr<Player>, 14> | 
Gets all players in the game
      
  | 
  static | 
Gets all Positions which are not out of bounds
| auto gameModel::Environment::getBallByID | ( | const communication::messages::types::EntityId & | id | ) | const -> std::shared_ptr<Ball> | 
Get the corresponding ball object to an given id.
| id | the id of the ball. | 
      
  | 
  static | 
Gets the type of the cell at position (x,y)
| x | xPosition from left, 0 based | 
| y | yPosition from bottom, 0 based | 
      
  | 
  static | 
See overloaded function above
| position | 
| auto gameModel::Environment::getFreeCellsForRedeploy | ( | const gameModel::TeamSide & | teamSide | ) | const -> const std::vector<gameModel::Position> | 
| teamSide | Teamside of the Player being redeployed | 
| env | the current Enivironment | 
      
  | 
  static | 
Gets all goal cells in left half of the game field.
      
  | 
  static | 
Gets all goal cells in right half of the game field.
| auto gameModel::Environment::getOpponents | ( | const std::shared_ptr< const Player > & | player | ) | const -> std::array<std::shared_ptr<Player>, 7> | 
Gets all players from the opponent team of the given player
| player | 
| auto gameModel::Environment::getPlayer | ( | const Position & | position | ) | const -> std::optional<std::shared_ptr<Player>> | 
Returns player object (if not banned) at the specified position if one exists
| auto gameModel::Environment::getPlayerById | ( | communication::messages::types::EntityId | id | ) | const -> std::shared_ptr<Player> | 
gets player by server entity id
| id | 
| runtime_error | when player cannot be found | 
| auto gameModel::Environment::getTeam | ( | const std::shared_ptr< const Player > & | player | ) | const -> std::shared_ptr<Team> | 
get the corresponding team of a player.
| player | the selected player. | 
| auto gameModel::Environment::getTeam | ( | TeamSide | side | ) | const -> std::shared_ptr<Team> | 
Gets the team on the specified side
| side | the side of the team | 
| auto gameModel::Environment::getTeamMates | ( | const std::shared_ptr< const Player > & | player | ) | const -> std::array<std::shared_ptr<Player>, 6> | 
Gets all players in the same team as the given player, themselves excluded
| player | 
      
  | 
  static | 
Checks if a given cell is a goal cell.
| pos | 
| auto gameModel::Environment::isPlayerInOpponentRestrictedZone | ( | const std::shared_ptr< const Player > & | player | ) | const -> bool | 
checks if a player is in the opponent restricted zone.
| player | the player. | 
| auto gameModel::Environment::isPlayerInOwnRestrictedZone | ( | const std::shared_ptr< const Player > & | player | ) | const -> bool | 
checks if a player is in the own restricted zone.
| player | the player. | 
| auto gameModel::Environment::isShitOnCell | ( | const Position & | position | ) | const -> bool | 
| void gameModel::Environment::placePlayerOnRandomFreeCell | ( | const std::shared_ptr< Player > & | player | ) | 
place a player on random free cell in their half of the game field.
| player | 
| void gameModel::Environment::removeDeprecatedShit | ( | ) | 
Removes all the cubes of shit spawned during the last round
| void gameModel::Environment::removeShitOnCell | ( | const Position & | position | ) | 
removes Shit on a given Position
| position | is the Position of the CubeOfShit which should be removed | 
 1.8.6