NerfUS game coordinator for the Nerf gun firing range
Dependencies: HardwareInterface mbed-rtos mbed
Fork of NerfUS by
Diff: source/GameCoordinator.cpp
- Revision:
- 16:5e6c695468b6
- Child:
- 18:469c8b2a9af9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/source/GameCoordinator.cpp Thu Feb 23 21:22:57 2017 -0500 @@ -0,0 +1,25 @@ +#include "GameCoordinator.hpp" + +GameCoordinator::GameCoordinator(RandomNumberGenerator& random_number_generator) : + random_number_generator(random_number_generator) +{ +} + +std::vector<TargetInfo> GameCoordinator::generate_random_target_course(const int number_of_targets, const int timeout_ms) +{ + std::vector<TargetInfo> target_course; + + for(int i=0; i<number_of_targets; ++i) + { + TargetInfo new_target; + + new_target.id = random_number_generator.get(0, number_of_targets - 1); + new_target.type = random_number_generator.get(0, 1) == 0 ? TARGET_TYPE_ALLY : TARGET_TYPE_ENEMY; + new_target.timeout_ms = timeout_ms; + + target_course.push_back(new_target); + } + + return target_course; +} +