17 Update(
const std::function<
void(std::unique_ptr<Play>)>& set_current_play,
18 const GameState& game_state,
const TbotsProto::AiConfig& ai_config)
19 : set_current_play(set_current_play),
20 game_state(game_state),
24 std::function<void(std::unique_ptr<Play>)> set_current_play;
26 TbotsProto::AiConfig ai_config;
44 bool gameStateHalted(
const Update& event);
45 bool gameStatePlaying(
const Update& event);
46 bool gameStateSetupRestart(
const Update& event);
55 void setupStopPlay(
const Update& event);
56 void setupHaltPlay(
const Update& event);
57 void setupOffensePlay(
const Update& event);
68 using namespace boost::sml;
70 DEFINE_SML_STATE(SetPlay)
71 DEFINE_SML_STATE(Halt)
72 DEFINE_SML_STATE(Playing)
73 DEFINE_SML_STATE(Stop)
76 DEFINE_SML_GUARD(gameStateHalted)
77 DEFINE_SML_GUARD(gameStatePlaying)
78 DEFINE_SML_GUARD(gameStateSetupRestart)
83 DEFINE_SML_ACTION(setupStopPlay)
84 DEFINE_SML_ACTION(setupHaltPlay)
85 DEFINE_SML_ACTION(setupOffensePlay)
88 return make_transition_table(
93 *Halt_S + Update_E[gameStateStopped_G] / setupStopPlay_A = Stop_S,
94 Halt_S + Update_E[gameStatePlaying_G] / setupOffensePlay_A = Playing_S,
95 Halt_S + Update_E[gameStateSetupRestart_G] / setupSetPlay_A = SetPlay_S,
99 Stop_S + Update_E[gameStateHalted_G] / setupHaltPlay_A = Halt_S,
100 Stop_S + Update_E[gameStatePlaying_G] / setupOffensePlay_A = Playing_S,
101 Stop_S + Update_E[gameStateSetupRestart_G] / setupSetPlay_A = SetPlay_S,
105 Playing_S + Update_E[gameStateHalted_G] / setupHaltPlay_A = Halt_S,
106 Playing_S + Update_E[gameStateStopped_G] / setupStopPlay_A = Stop_S,
107 Playing_S + Update_E[gameStateSetupRestart_G] / setupSetPlay_A = SetPlay_S,
111 SetPlay_S + Update_E[gameStateHalted_G] / (resetSetPlay_A, setupHaltPlay_A) =
113 SetPlay_S + Update_E[gameStateStopped_G] / (resetSetPlay_A, setupStopPlay_A) =
115 SetPlay_S + Update_E[gameStatePlaying_G] /
116 (resetSetPlay_A, setupOffensePlay_A) = Playing_S,
117 SetPlay_S + Update_E[gameStateSetupRestart_G] / setupSetPlay_A,
123 TbotsProto::AiConfig ai_config;
124 std::optional<TbotsProto::PlayName> current_set_play;