This class is the engine of the program. It encapsulates all the methods to do with managing scores, commands and player states(dead/alive).
Operator Class Reference
#include <Operator.h>
Public Member Functions | |
| Operator () | |
| Contructor. | |
| ~Operator () | |
| Destructor. | |
| int | random_instruction (Display &display, N5110 &lcd) |
| generates a random integer to be used in the display class to represent an instruction | |
| bool | test_player (int nextplayer, Controller &ctrl, Display &display, N5110 &lcd) |
| Method to test the player. | |
| bool | both_dead () |
| Method to check if both players are dead. | |
| void | correct (int current_player, Controller &ctrl) |
| Method performed when the user performs the RIGHT instruction on time, score is increased, lighting and sound performed. | |
| void | inCorrect (int current_player, Controller &ctrl) |
| Method performed when the user performs the WRONG instruction on time. | |
| void | setup_players (int num_players) |
| Method to set up array of Player strut. | |
| void | gameOver (Controller &ctrl, N5110 &lcd) |
| Method performed when the user is too slow or performs the wrong instruction, score is displayed, game ends. | |
| int | check_next_player (int current_player, N5110 &lcd, Controller &ctrl, Display display) |
| Method performed to check which user it is and to swap after every ten actions. | |
Detailed Description
Operator Class.
This class is the engine of the program. It encapsulates all the methods to do with managing scores, commands and player states(dead/alive).
- Date:
- April 2017
Definition at line 32 of file Operator.h.
Constructor & Destructor Documentation
| Operator | ( | ) |
Contructor.
Definition at line 3 of file Operator.cpp.
| ~Operator | ( | ) |
Destructor.
Definition at line 10 of file Operator.cpp.
Member Function Documentation
| bool both_dead | ( | ) |
Method to check if both players are dead.
- Returns:
- true/false
Definition at line 63 of file Operator.cpp.
| int check_next_player | ( | int | current_player, |
| N5110 & | lcd, | ||
| Controller & | ctrl, | ||
| Display | display | ||
| ) |
Method performed to check which user it is and to swap after every ten actions.
Definition at line 78 of file Operator.cpp.
| void correct | ( | int | current_player, |
| Controller & | ctrl | ||
| ) |
Method performed when the user performs the RIGHT instruction on time, score is increased, lighting and sound performed.
- Parameters:
-
the player, Controller
Definition at line 44 of file Operator.cpp.
| void gameOver | ( | Controller & | ctrl, |
| N5110 & | lcd | ||
| ) |
Method performed when the user is too slow or performs the wrong instruction, score is displayed, game ends.
- Parameters:
-
the player, Controller
Definition at line 151 of file Operator.cpp.
| void inCorrect | ( | int | current_player, |
| Controller & | ctrl | ||
| ) |
Method performed when the user performs the WRONG instruction on time.
- Parameters:
-
the player, Controller
Definition at line 56 of file Operator.cpp.
| int random_instruction | ( | Display & | display, |
| N5110 & | lcd | ||
| ) |
generates a random integer to be used in the display class to represent an instruction
- Parameters:
-
Display,N5110
- Returns:
- random integer
Definition at line 35 of file Operator.cpp.
| void setup_players | ( | int | num_players ) |
Method to set up array of Player strut.
- Parameters:
-
the number of players to set up
Definition at line 132 of file Operator.cpp.
| bool test_player | ( | int | nextplayer, |
| Controller & | ctrl, | ||
| Display & | display, | ||
| N5110 & | lcd | ||
| ) |
Method to test the player.
- Parameters:
-
the player to test, Controller, Display, N5110
- Returns:
- true/false on Success
Definition at line 16 of file Operator.cpp.
Generated on Sat Jul 16 2022 02:04:54 by
1.7.2