Records
Functions
-
promise_impl< ::fpromise::internal::context_handler_invoker<(lambda at ../../sdk/lib/fit-promise/tests/examples/promise_example2.cc:52:7)>> roll_die (std::string player, std::string type, int number_of_sides)Rolls a die and waits for it to settle down then returns its value.
This task might fail so the caller needs to be prepared to re-roll.
This function demonstrates returning pending, error, and ok states as well
as task suspension.
Defined at line 50 of file ../../sdk/lib/fit-promise/tests/examples/promise_example2.cc
-
fpromise::promise<int> roll_die_until_successful (std::string player, std::string type, int number_of_sides)Re-rolls a die until it succeeds.
This function demonstrates looping a task using a recursive tail-call.
Defined at line 76 of file ../../sdk/lib/fit-promise/tests/examples/promise_example2.cc
-
promise_impl< ::fpromise::internal::context_handler_invoker<(lambda at ../../sdk/lib/fit-promise/tests/examples/promise_example2.cc:94:7)>> roll_for_damage (std::string player)Rolls an effect and damage die.
If the effect die comes up 0 then also rolls an effect multiplier die to
determine the strength of the effect. We can do this while waiting
for the damage die to settle down.
This functions demonstrates the benefits of capturing a task into a
|fpromise::future| so that its result can be retained and repeatedly
examined while awaiting other tasks.
Defined at line 92 of file ../../sdk/lib/fit-promise/tests/examples/promise_example2.cc
-
promise_impl< ::fpromise::internal::and_then_continuation<promise_impl<fpromise::internal::join_continuation<fpromise::promise_impl<fpromise::internal::context_handler_invoker<(lambda at ../../sdk/lib/fit-promise/tests/examples/promise_example2.cc:94:7)>>, fpromise::promise_impl<fpromise::internal::context_handler_invoker<(lambda at ../../sdk/lib/fit-promise/tests/examples/promise_example2.cc:94:7)>>>>, (lambda at ../../sdk/lib/fit-promise/tests/examples/promise_example2.cc:148:17)>> play_round (const std::shared_ptr<game_state> & state)Plays one round of the game.
Both players roll dice simultaneously to determine the damage dealt
to their opponent.
This function demonstrates joining the results of concurrently executed
tasks as a new task which produces a tuple.
Defined at line 146 of file ../../sdk/lib/fit-promise/tests/examples/promise_example2.cc
-
promise_impl< ::fpromise::internal::context_handler_invoker<(lambda at ../../sdk/lib/fit-promise/tests/examples/promise_example2.cc:164:7)>> play_game ()Plays a little game.
Red and Blue each start with 100 hit points.
During each round, they both simultaneously roll dice to determine damage to
their opponent. If at the end of the round one player's hit-points reaches
0, that player loses. If both players' hit-points reach 0, they both lose.
Defined at line 161 of file ../../sdk/lib/fit-promise/tests/examples/promise_example2.cc
-
void run ()Defined at line 187 of file ../../sdk/lib/fit-promise/tests/examples/promise_example2.cc