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:
- 11:48190450b7e5
- Parent:
- 9:54c620f7d736
- Child:
- 12:bdaf4e1d615e
diff -r e0e820636025 -r 48190450b7e5 Operator.h --- a/Operator.h Mon Apr 24 09:47:05 2017 +0000 +++ b/Operator.h Mon May 01 17:04:21 2017 +0000 @@ -5,14 +5,30 @@ #include "N5110.h" #include "Display.h" #include "Controller.h" +/** Player Struct +@brief This Struct stores:- whether the previous player has already lost the game or not, how much time they intially had to +perform an instruction and the score they have. This struct is crucial for multiplayer. +@author Dominic Kay + +@date April 2017 +*/ struct Player { - float wait; /**< float for wair time */ + float wait; /**< float for wait time */ bool status; /**< true/flase alive or dead */ - int score; /**< score */ + int _score; /**< score */ }; +/** Operator Class +@brief This class encapsulates all the algorithms required for managing scores, commands and player states(dead/alive). + +@author Dominic Kay + +@date April 2017 +*/ + + class Operator { @@ -48,12 +64,12 @@ /** Method performed when the user performs the RIGHT instruction on time, score is increased, lighting and sound performed. * @param the player, Controller */ - void Correct(int next_player, Controller &ctrl); + void correct(int next_player, Controller &ctrl); /** Method performed when the user performs the WRONG instruction on time * @param the player, Controller */ - void InCorrect(int next_player, Controller &ctrl); + void inCorrect(int next_player, Controller &ctrl); /** Method to set up array of Player strut * @param the number of players to set up @@ -63,30 +79,30 @@ /** Method performed when the user is too slow or performs the wrong instruction, score is displayed, game ends * @param the player, Controller */ - void Game_Over(Controller &ctrl, N5110 &lcd); + void gameOver(Controller &ctrl, N5110 &lcd); -/** Method performed to chech which user it is and to swap after exch ten*/ +/** Method performed to check which user it is and to swap after every ten actions*/ 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. * @param N5110, score */ - void Assessment(N5110 &lcd, int score); + void _assessment(N5110 &lcd, int score); /** This methord displays and assesses scores when multi-player * @param N5110 */ - void MultiResults(N5110 &lcd); + void _multiResults(N5110 &lcd); /** This method counts down the next player * @param Controller, N5110, the player to display next turn */ - void DisplayNextPlayer(Controller &ctrl, N5110 &lcd, int thenext_player); + void _displayNextPlayer(Controller &ctrl, N5110 &lcd, int thenext_player); - float freq_change; - int score; // <score to indentify users progress through game + float _freqChange; + int _score; // <score to indentify users progress through game Player myplayers[1]; //setup players int _num_players; //set num_players