soccer_strategy.game_engine_2d_with_referee.GameEngine2DWithReferee
- class soccer_strategy.game_engine_2d_with_referee.GameEngine2DWithReferee(*args, **kwargs)[source]
Bases:
GameEngine2D
2D simualtor for the game engine, used for testing strategy quickly without interfacing with webots
- __init__(*args, **kwargs)[source]
- Parameters:
display – Whether to show the visualizer
team_1_strategy – What strategy the team 1 will use
team_2_strategy – What strategy the team 2 will use
game_duration – How long to run the game (in minutes)
Methods
__init__
(*args, **kwargs)- param display:
Whether to show the visualizer
gamestate_callback_robot
(gameState, robot)Callback function for gamestate information from the webot's game controller
Reset's the robot and the team back to their initial state, so a new game happen
run
()Main loop for the 2D strategy executor, runs the strategies for both team against a vispy simulator
update_estimated_physics
(robots, ball)Executes the world physics step, robot's movement, ball movement, and for fairness it runs through the priority for kicks in a random fashion.
Attributes
DISPLAY_UPDATE_INTERVAL
GAMESTATE_LOOKUP
PHYSICS_UPDATE_INTERVAL
SECONDARY_STATE_LOOKUP
SECONDARY_STATE_MODE_LOOKUP
- gamestate_callback_robot(gameState: GameState, robot: RobotControlled2D)[source]
Callback function for gamestate information from the webot’s game controller
- Parameters:
gameState – Contains information about the game, whether it is playing or paused etc
- reset_robots()
Reset’s the robot and the team back to their initial state, so a new game happen
- run()[source]
Main loop for the 2D strategy executor, runs the strategies for both team against a vispy simulator
- update_estimated_physics(robots: [<class 'soccer_strategy.robot_controlled_2d.RobotControlled2D'>], ball: ~soccer_strategy.ball.Ball)
Executes the world physics step, robot’s movement, ball movement, and for fairness it runs through the priority for kicks in a random fashion.
- Parameters:
robots – The list of all robots including enemy robots
ball – The ball in the game