Class to handle the Connect 4 game logic.
More...
#include <con4.h>
|
| Con4 () |
| Constructor for the Connect4 class.
|
|
void | populategrid () |
| Populates the game grid with initial values.
|
|
void | dropcoin (int column, int playercoin) |
| Drops a coin into the specified column. More...
|
|
void | checkdraw () |
| Checks if the game is a draw.
|
|
void | checkwin () |
| Checks if there is a winning condition on the board.
|
|
int | randomstarter () |
| Randomly selects the starting player. More...
|
|
void | swapturn (int playert) |
| Swaps the turn between players. More...
|
|
void | playerturn (int player) |
| Handles the player's turn. More...
|
|
void | connect4 () |
| Main function to run the Connect 4 game.
|
|
Class to handle the Connect 4 game logic.
◆ dropcoin()
void Con4::dropcoin |
( |
int |
column, |
|
|
int |
playercoin |
|
) |
| |
Drops a coin into the specified column.
- Parameters
-
column | The column to drop the coin into. |
playercoin | The coin of the player. |
◆ playerturn()
void Con4::playerturn |
( |
int |
player | ) |
|
Handles the player's turn.
- Parameters
-
player | The current player. |
◆ randomstarter()
int Con4::randomstarter |
( |
| ) |
|
Randomly selects the starting player.
- Returns
- int The starting player (1 or 2).
◆ swapturn()
void Con4::swapturn |
( |
int |
playert | ) |
|
Swaps the turn between players.
- Parameters
-
playert | The current player. |
The documentation for this class was generated from the following files: