Class LOGIC::cla_player
ClassList > LOGIC > cla_player
This class represents a player in the game. It provides methods for moving tokens and checking the status of the player. It is an abstract class and has two derived classes: cla_computer_player andcla_manual_player .
#include <logic.hpp>
Inherited by the following classes: LOGIC::cla_computer_player, LOGIC::cla_manual_player
Public Functions
Type | Name |
---|---|
virtual int8_t | Auto_Move (uint8_t _u8_dice_value, bool & _bool_occupied_flag, uint8_t & _u8_old_position) |
uint8_t | Calculate_Possible_Position (uint8_t _u8_token_number, uint8_t _u8_dice_value) Calculates the possible position of a token. |
uint8_t | Get_Player_Progress () Returns the overall progress of the player (Value between 1-28). |
status | Get_Player_Status () Outputs the status of player. |
uint8_t | Get_Start_Position () Returns the starting position of the player. |
uint8_t | Get_Token_Position (uint8_t _u8_token_number) Returns the current position of a token. |
uint8_t | Get_Token_Progress (uint8_t _u8_token_number) Returns the progress of a token on the track. |
virtual bool | Is_Computer () const = 0 Checks if the player is a computer opponent. |
int8_t | Is_Start_Field_Occupied_By_Own_Token () Checks if the starting square is occupied by own token while other tokens are home. |
uint8_t | Move_Token (uint8_t _u8_token_number, uint8_t _u8_dice_value) Moves a token on the track. |
uint8_t | Set_Token_Position (uint8_t _u8_token_number, uint8_t _u8_new_position) Changes the position of a token. |
cla_player (uint8_t _u8_player_id, uint8_t _u8_start_position, uint8_t _u8_computer_quantity, cla_session * _obj_my_session) Constructor for the cla_player class. |
Protected Attributes
Type | Name |
---|---|
cla_session * | obj_my_session Pointer to the associated session. |
uint8_t | u8_player_id The id of the player. |
uint8_t | u8_start_position The starting position of the player. |
uint8_t | u8_token_position The positions of the player's four tokens. |
Public Functions Documentation
function Auto_Move
virtual int8_t LOGIC::cla_player::Auto_Move (
uint8_t _u8_dice_value,
bool & _bool_occupied_flag,
uint8_t & _u8_old_position
)
function Calculate_Possible_Position
Calculates the possible position of a token.
uint8_t LOGIC::cla_player::Calculate_Possible_Position (
uint8_t _u8_token_number,
uint8_t _u8_dice_value
)
Parameters:
_u8_token_number
The token number._u8_dice_value
The value of the rolled dice.
Returns:
The calculated position of the token.
function Get_Player_Progress
Returns the overall progress of the player (Value between 1-28).
uint8_t LOGIC::cla_player::Get_Player_Progress ()
Returns:
The overall progress of the player on the track.
function Get_Player_Status
Outputs the status of player.
status LOGIC::cla_player::Get_Player_Status ()
Returns:
The status of the player.
function Get_Start_Position
uint8_t LOGIC::cla_player::Get_Start_Position ()
function Get_Token_Position
Returns the current position of a token.
uint8_t LOGIC::cla_player::Get_Token_Position (
uint8_t _u8_token_number
)
Parameters:
_u8_token_number
The token number.
Returns:
The current position of the token.
function Get_Token_Progress
Returns the progress of a token on the track.
uint8_t LOGIC::cla_player::Get_Token_Progress (
uint8_t _u8_token_number
)
Parameters:
_u8_token_number
The token number.
Returns:
The progress of the token on the track.
function Is_Computer
Checks if the player is a computer opponent.
virtual bool LOGIC::cla_player::Is_Computer () const = 0
Returns:
true if the player is a computer opponent, false otherwise.
function Is_Start_Field_Occupied_By_Own_Token
Checks if the starting square is occupied by own token while other tokens are home.
int8_t LOGIC::cla_player::Is_Start_Field_Occupied_By_Own_Token ()
Returns:
The token number that must be moved
function Move_Token
Moves a token on the track.
uint8_t LOGIC::cla_player::Move_Token (
uint8_t _u8_token_number,
uint8_t _u8_dice_value
)
Parameters:
_u8_token_number
The token number._u8_dice_value
The value of the rolled dice.
Returns:
The new position of the token.
function Set_Token_Position
Changes the position of a token.
uint8_t LOGIC::cla_player::Set_Token_Position (
uint8_t _u8_token_number,
uint8_t _u8_new_position
)
Parameters:
_u8_token_number
The token number._u8_new_position
The new position of the token.
Returns:
The new position of the token.
function cla_player
Constructor for the cla_player class.
LOGIC::cla_player::cla_player (
uint8_t _u8_player_id,
uint8_t _u8_start_position,
uint8_t _u8_computer_quantity,
cla_session * _obj_my_session
)
Parameters:
_u8_player_id
The ID of the player._u8_start_position
The individual starting position of the player._u8_computer_quantity
The number of computer controlled players._obj_my_session
Pointer to the associated session.
Protected Attributes Documentation
variable obj_my_session
cla_session* LOGIC::cla_player::obj_my_session;
variable u8_player_id
uint8_t LOGIC::cla_player::u8_player_id;
variable u8_start_position
uint8_t LOGIC::cla_player::u8_start_position;
variable u8_token_position
uint8_t LOGIC::cla_player::u8_token_position[4];
The documentation for this class was generated from the following file /home/runner/work/Arduino_DHBW_Spiel/Arduino_DHBW_Spiel/Engineering/COD_ENG_OUT_arduino_code/lib/Game_Logic/logic.hpp