| OOP A3 Board Games 35 a Board Game Project Made by Students at Cairo FCAI

Loading...
Searching...
No Matches
Player< T > Class Template Reference

Base template for all players (human or AI). More...

`#include <BoardGame_Classes.h>`

## Public Member Functions
| Player (string n, T s, PlayerType t)
| Construct a player with name, symbol, and type.
virtual | ~Player ()
string | get_name () const
| Get the player's name.
PlayerType | get_type () const
| Get player type (e.g., 'H' or 'C').
T | get_symbol () const
| Get the player's symbol.
Board< T > * | get_board_ptr () const
| Get a pointer to the game board.
void | set_board_ptr (Board< T > *b)
| Assign the board pointer for the player.

## Protected Attributes
string | name
| Player name.
PlayerType | type
| Player type (e.g., HUMAN or COMPUTER).
T | symbol
| Player’s symbol on board.
Board< T > * | boardPtr
| Pointer to the game board.

## Detailed Description

template<typename T>
class Player< T >

Base template for all players (human or AI).

Template Parameters

  T | Type of symbol used by the player.

## Constructor & Destructor Documentation

## ◆ Player()

template<typename T>

Player< T >::Player | ( | string | n,
|  | T | s,
|  | PlayerType | t )
| inline

Construct a player with name, symbol, and type.

## ◆ ~Player()

template<typename T>

virtual Player< T >::~Player | ( |  | ) |
| inline virtual

## Member Function Documentation

## ◆ get_board_ptr()

template<typename T>

Board< T > * Player< T >::get_board_ptr | ( |  | ) | const
| inline

Get a pointer to the game board.

## ◆ get_name()

template<typename T>

string Player< T >::get_name | ( |  | ) | const
| inline

Get the player's name.

## ◆ get_symbol()

template<typename T>

T Player< T >::get_symbol | ( |  | ) | const
| inline

Get the player's symbol.

## ◆ get_type()

template<typename T>

PlayerType Player< T >::get_type | ( |  | ) | const
| inline

Get player type (e.g., 'H' or 'C').

## ◆ set_board_ptr()

template<typename T>

void Player< T >::set_board_ptr | ( | Board< T > * | b | ) |
| inline

Assign the board pointer for the player.

## Member Data Documentation

## ◆ boardPtr

template<typename T>

Board<T>* Player< T >::boardPtr
| protected

Pointer to the game board.

## ◆ name

template<typename T>

string Player< T >::name
| protected

Player name.

## ◆ symbol

template<typename T>

T Player< T >::symbol
| protected

Player’s symbol on board.

## ◆ type

template<typename T>

PlayerType Player< T >::type
| protected

Player type (e.g., HUMAN or COMPUTER).

The documentation for this class was generated from the following file:

- BoardGame_Classes.h