This class is the engine of the program. It encapsulates all the methods to do with managing scores, commands and player states(dead/alive).
Diff: Operator.h
- Revision:
- 8:93f18f1c1241
- Parent:
- 7:5d9b9d0bc6e7
- Child:
- 9:54c620f7d736
diff -r 5d9b9d0bc6e7 -r 93f18f1c1241 Operator.h --- a/Operator.h Sun Apr 16 19:37:55 2017 +0000 +++ b/Operator.h Fri Apr 21 10:55:23 2017 +0000 @@ -6,6 +6,13 @@ #include "Display.h" #include "Controller.h" + +struct Player { + float wait; /**< float for wair time */ + bool status; /**< true/flase alive or dead */ + int score; /**< score */ +}; + class Operator { @@ -24,19 +31,46 @@ */ int random_instruction(Display &display, N5110 &lcd); -/** Methord performed when the user performs the right instruction on time, score is increased, lighting and sound performed.*/ - void Correct(Controller &ctrl); - +/** + * @brief Method to test the player + * @return true/false on Success + */ + bool test_player(int nextplayer, Controller &ctrl, Display &display, N5110 &lcd); + +/** + * @brief Method to check if both players are dead + * @return true/false + */ + bool check_dead(); + +/** Method performed when the user performs the RIGHT instruction on time, score is increased, lighting and sound performed.*/ + void Correct(int next_player, Controller &ctrl); + +/** Method performed when the user performs the WRONG instruction on time */ + void InCorrect(int next_player, Controller &ctrl); + +/** Methord to set up array of Player stut */ + + void setup_players(int num_players); + /** Methord performed when the user is too slow or performs the wrong instruction, score is displayed, game ends */ void Game_Over(Controller &ctrl, N5110 &lcd); +/** Methord performed to chech which user it is and to swap after exch ten*/ + int check_next_player(int next_player, N5110 &lcd, Controller &ctrl, Display display); + private: /** This methord displays and assesses score and display a performace rating for user to see.*/ void Assessment(N5110 &lcd, int score); + + /** This methord displays and assesses scores when multi-player*/ + void MultiResults(N5110 &lcd); + float freq_change; int score; // <score to indentify users progress through game - + Player myplayers[1]; //setup players + int _num_players; //set num_players };