Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Scoreboard Class Reference
Scoreboard Class. More...
#include <Scoreboard.h>
Public Member Functions | |
| Scoreboard () | |
| Constructor. | |
| ~Scoreboard () | |
| Deconstructor. | |
| void | init () |
| Initlialises the Scoreboard class. | |
| void | draw (N5110 &lcd) |
| Prints the score and target values to the LCD. | |
| void | update_score (int runs) |
| Updates the score by adding the runs to the score. | |
| void | reset () |
| Resets the score value to 0. | |
| void | generate_target () |
| Sets a target score for each game. | |
| bool | compare_target () |
| Compares the current score with the target score during each round. | |
| int | get_score () |
| returns the intetger score | |
| int | get_target () |
| getter method:returns the target for the game | |
Detailed Description
Scoreboard Class.
- Date:
- May 2019
Definition at line 14 of file Scoreboard.h.
Constructor & Destructor Documentation
| Scoreboard | ( | ) |
Constructor.
Definition at line 4 of file Scoreboard.cpp.
| ~Scoreboard | ( | ) |
Deconstructor.
Definition at line 9 of file Scoreboard.cpp.
Member Function Documentation
| bool compare_target | ( | ) |
Compares the current score with the target score during each round.
- Returns:
- a boolean value, true if the score is = or > the score, false if is < score
Definition at line 61 of file Scoreboard.cpp.
| void draw | ( | N5110 & | lcd ) |
Prints the score and target values to the LCD.
- Parameters:
-
&lcd reference object for a N5110 class object
Definition at line 36 of file Scoreboard.cpp.
| void generate_target | ( | ) |
Sets a target score for each game.
The target score is generated as a random value between 20 and 36
Definition at line 54 of file Scoreboard.cpp.
| int get_score | ( | ) |
returns the intetger score
- Returns:
- the score at the current round
Definition at line 26 of file Scoreboard.cpp.
| int get_target | ( | ) |
getter method:returns the target for the game
- Returns:
- the score for the game
Definition at line 31 of file Scoreboard.cpp.
| void init | ( | ) |
Initlialises the Scoreboard class.
Sets the target and score value to 0
Definition at line 14 of file Scoreboard.cpp.
| void reset | ( | ) |
Resets the score value to 0.
Definition at line 48 of file Scoreboard.cpp.
| void update_score | ( | int | runs ) |
Updates the score by adding the runs to the score.
- Parameters:
-
runs runs scored in the round passed as an integer value
Definition at line 22 of file Scoreboard.cpp.
Generated on Tue Jul 19 2022 18:37:30 by
1.7.2