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.cpp@2:6eebea9a6a86, 2017-04-12 (annotated)
- Committer:
- domkay97
- Date:
- Wed Apr 12 23:46:29 2017 +0000
- Revision:
- 2:6eebea9a6a86
- Parent:
- 1:0f98beb0993b
- Child:
- 3:7213eee4c093
Increased random number range to incorporate more inputs
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
domkay97 | 0:3097759acb02 | 1 | #include "Operator.h" |
domkay97 | 0:3097759acb02 | 2 | |
domkay97 | 0:3097759acb02 | 3 | Operator::Operator() |
domkay97 | 0:3097759acb02 | 4 | { |
domkay97 | 0:3097759acb02 | 5 | |
domkay97 | 0:3097759acb02 | 6 | } |
domkay97 | 0:3097759acb02 | 7 | |
domkay97 | 0:3097759acb02 | 8 | Operator::~Operator() |
domkay97 | 0:3097759acb02 | 9 | { |
domkay97 | 0:3097759acb02 | 10 | |
domkay97 | 0:3097759acb02 | 11 | } |
domkay97 | 0:3097759acb02 | 12 | |
domkay97 | 0:3097759acb02 | 13 | |
domkay97 | 0:3097759acb02 | 14 | void Operator::init() |
domkay97 | 0:3097759acb02 | 15 | { |
domkay97 | 0:3097759acb02 | 16 | } |
domkay97 | 1:0f98beb0993b | 17 | int Operator::read_input(Controller &pad) { |
domkay97 | 0:3097759acb02 | 18 | |
domkay97 | 0:3097759acb02 | 19 | return(pad.check_for_buttons()); |
domkay97 | 0:3097759acb02 | 20 | } |
domkay97 | 0:3097759acb02 | 21 | |
domkay97 | 0:3097759acb02 | 22 | |
domkay97 | 1:0f98beb0993b | 23 | int Operator::random_instruction(Display &display, N5110 &lcd) { |
domkay97 | 2:6eebea9a6a86 | 24 | int ran = rand() % 7 + 1; |
domkay97 | 1:0f98beb0993b | 25 | display.display_instruction(lcd, ran); |
domkay97 | 1:0f98beb0993b | 26 | return ran; |
domkay97 | 1:0f98beb0993b | 27 | } |
domkay97 | 1:0f98beb0993b | 28 | |
domkay97 | 1:0f98beb0993b | 29 |