![]() |
ConnectX 3.0
ConnectX Game Suite
|
#include <rules.hpp>
Public Member Functions | |
| GameRules (uint8_t connect_length=4) | |
| bool | checkWin (const Board &board, uint8_t player_id) const |
| bool | checkDraw (const Board &board) const |
| bool | isValidMove (const Board &board, uint8_t column) const |
| uint8_t | getConnectLength () const |
Encapsulates game rules and win condition checking
|
explicit |
Constructor
| connect_length | Number of consecutive pieces needed to win (default 4) |
| bool GameRules::checkDraw | ( | const Board & | board | ) | const |
Check if the game is a draw (board full, no winner)
| bool GameRules::checkWin | ( | const Board & | board, |
| uint8_t | player_id | ||
| ) | const |
Check if a specific player has won
| board | Current board state |
| player_id | Player to check |
|
inline |
| bool GameRules::isValidMove | ( | const Board & | board, |
| uint8_t | column | ||
| ) | const |
Validate if a move is legal