NerfUS game coordinator for the Nerf gun firing range

Dependencies:   HardwareInterface mbed-rtos mbed

Fork of NerfUS by NerfUS

Branch:
PlayableGame
Revision:
17:48474266a361
Child:
18:469c8b2a9af9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/source/PlayableGame.cpp	Fri Mar 17 17:19:42 2017 -0400
@@ -0,0 +1,33 @@
+#include "PlayableGame.hpp"
+
+PlayableGame::PlayableGame(RandomNumberGenerator& random_number_generator) :
+    random_number_generator(random_number_generator)
+{
+}
+
+bool PlayableGame::IsWeaponValid(int weaponId)
+{
+    return true;
+}
+
+TargetInfo PlayableGame::GetRandomTarget(int timeout_ms)
+{
+    TargetInfo new_target;
+
+    new_target.id = random_number_generator.get(0, NUMBER_OF_TARGETS);
+    new_target.type = random_number_generator.get(0, 1) == 0 ? TARGET_TYPE_ALLY : TARGET_TYPE_ENEMY;
+    new_target.timeout_ms = timeout_ms;
+
+    return new_target;
+}
+
+int PlayableGame::GetPoints()
+{
+    return points;
+}
+
+GameStats PlayableGame::GetStats()
+{
+    stats.accuracy = stats.numberOfHits * 10000 / (stats.numberOfHits + stats.numberOfMiss);
+    return stats;
+}
\ No newline at end of file