poCker
Loading...
Searching...
No Matches
player.h File Reference

Contains a Player struct and related functions. More...

#include <stdbool.h>
#include "playingcard.h"
#include "gamerules.h"

Go to the source code of this file.

Classes

struct  Player
 Represents a single player. More...
 

Macros

#define SCORE_TABLE_SIZE   10
 Defines the size of the scores array.
 

Functions

PlayerplayerCreateNew ()
 Creates a new Player struct.
 
PlayerplayerCreateNewWithFunds (int)
 Creates a new Player struct instance and sets its funds value.
 
void resetScores (Player *)
 Resets player's scores to an array of zeros.
 

Detailed Description

Contains a Player struct and related functions.

Function Documentation

◆ playerCreateNew()

Player * playerCreateNew ( )

Creates a new Player struct.

Returns
A pointer to it.

◆ playerCreateNewWithFunds()

Player * playerCreateNewWithFunds ( int initial_funds)

Creates a new Player struct instance and sets its funds value.

Parameters
initial_fundsThe amount of funds to be assigned.
Returns
A pointer to the created struct.

A rude remainder on why lack of polymorphism is a bit of a bummer.

◆ resetScores()

void resetScores ( Player * self)

Resets player's scores to an array of zeros.

Parameters
selfThe Player struct whose table should be reset.

Remember that C does not have zero-initialization. The scores array WILL be filled with gibberish data.