ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Scoreboard Class Reference

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.

Author:
Shahid Zubin Sajid Class to control the score and target for the game and print the values to screen
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:
&lcdreference 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:
runsruns scored in the round passed as an integer value

Definition at line 22 of file Scoreboard.cpp.