Declaration of game-related constants, definition of game-related structures and functions.
More...
|
#define | Ace 1 |
| Integer const to represent rank ace.
|
#define | Two 2 |
| Integer const to represent rank two.
|
#define | Three 3 |
| Integer const to represent rank three.
|
#define | Four 4 |
| Integer const to represent rank four.
|
#define | Five 5 |
| Integer const to represent rank five.
|
#define | Six 6 |
| Integer const to represent rank six.
|
#define | Seven 7 |
| Integer const to represent rank seven.
|
#define | Jack 8 |
| Integer const to represent rank jack.
|
#define | Queen 9 |
| Integer const to represent rank queen.
|
#define | King 10 |
| Integer const to represent rank king.
|
#define | Clubs 11 |
| Integer const to represent suit clubs.
|
#define | Spades 12 |
| Integer const to represent suit spades.
|
#define | Diamonds 13 |
| Integer const to represent suit diamonds.
|
#define | Hearts 14 |
| Integer const to represent suit hearts.
|
#define | _MAIN_H_ |
|
void | checkTerminal () |
| Checks if the terminal size is suitable for the TUI (Terminal User Interface); if the terminal it is too small, it exits with EXIT_TERMINAL_TOO_SMALL exit code. On Windows, it checks if the terminal's host process is supported, otherwise it exits with EXIT_WINDOWS_TERMINAL_HOST_NOT_SUPPORTED exit code.
|
void | setupTerminal () |
| On Windows, configures that the terminal such that it supports UTF-8 encoded chars.
|
bool | checkTerminalHost () |
| On Windows, it checks if the terminal's host process is supported.
|
bool | checkTerminalSize () |
| Checks if the terminal size is suitable for the TUI (Terminal User Interface).
|
int | randomInt (const int min, const int max) |
| Generates a random number in the range (inclusive).
|
int | askPlayerNumber () |
| Asks the number of players to the user.
|
Card | buildCard () |
| Generates a card.
|
Card * | buildDeck () |
| Generates a deck.
|
Player * | buildPlayer () |
| Generates a player.
|
Game | buildGame (int playersCounter) |
| Generates a game with the given number of players.
|
void | freeDeck (Card *deck) |
| Frees the cards deck.
|
void | freePlayer (Player *player) |
| Frees a player.
|
void | freePlayers (Player **players, int playersCounter) |
| Free all the players in the vector.
|
void | freeGame (Game *game) |
| Frees a game structure.
|
Card * | prepareCardDeck () |
| Generates a deck with cards ordered randomly. It is guaranteed that no duplicated cards occurs in the same deck.
|
Player * | preparePlayer (int id, Card *deck, GameConfiguration configuration) |
| Generates a player structure with the given player id and with the given data gave by the game configuration.
|
Game | prepareGame (int playersCounter, Card *deck, GameConfiguration gameConfiguration, LogsConfiguration logsConfiguration) |
| Generates a game structure with the given players number and with the given data gave by the game configuration.
|
void | shuffleDeck (Card *deck) |
| Shuffles the deck using Fisher - Yates algorithm.
|
bool | handleGamePhase (Game *game) |
| Handles the current game phase.
|
bool | isGameEnded (Game *game) |
| Determines whether the game is ended.
|
bool | applyEffect (Game *game, int playerPosition, bool facedUpCard) |
| Applies the effect of the player at the given index in the players vector.
|
bool | revealFacedDownCard (Card card) |
| Asks to the player if he wants to reveal the faced down card.
|
void | giveCards (Game *game, Card *deck) |
| Assigns new cards to the player. It is not guaranteed that the old cards might be reassigned to the same player.
|
void | announceDeadPlayers (Game *game) |
| Announces the dead players.
|
int | countDeadPlayers (Game *game) |
| Counts how many dead players there are in the players vector.
|
void | removeDeadPlayers (Game *game) |
| Removes the dead players from the players vector.
|
void | withdrawCards (Game *game) |
| Generates via the function buildCard new cards that are given to the players.
|
void | announceWinner (Player player) |
| Announces the winner.
|
bool | deckHasCard (Card *deck, Card card) |
| Checks if a card is present in a deck.
|
bool | cardAreEqual (Card card1, Card card2) |
| Checks if two cards are equal.
|
bool | cardsWereGiven (Player **players, int playersCounter, Player player) |
| Checks if the cards of a given player have been already given to other players.
|
void | revealCard (Card card, int playerId, bool facedUp, bool newLine) |
| Prints user-friendly the card revealed from a player.
|
void | printCardEffect (Card card, bool newLine) |
| Prints user-friendly the card's effect.
|
void | tellFacedDownCard (Card card, int playerId) |
| Prints user-friendly the faced down card revealed of the player.
|
Declaration of game-related constants, definition of game-related structures and functions.
Definition in file main.h.