Manager (model.game.manager)¶
model.game.manager
¶
Game manager coordinating board state, turn alternation, clock ticks, and game rules.
GameManager
¶
Core game orchestrator managing turns, clocks, moves, and terminal game conditions.
Source code in src/model/game/manager.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
__init__(board=None, players=None, timer=None, logger=None, validator=None)
¶
Initialize a GameManager instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
board
|
Optional[Board]
|
Optional Board instance (defaults to standard 8x8 Board). |
None
|
players
|
Optional[List[Player]]
|
Optional list of Player instances (defaults to White and Black players). |
None
|
timer
|
Optional[Timer]
|
Optional Timer instance (defaults to standard 600s timer). |
None
|
logger
|
Optional[GameLogger]
|
Optional GameLogger instance. |
None
|
validator
|
Optional[MoveValidator]
|
Optional MoveValidator instance. |
None
|
Source code in src/model/game/manager.py
cancel_move()
¶
get_state()
¶
Evaluate and return the current state of the game.
Returns:
| Type | Description |
|---|---|
int
|
Integer state constant: STATE_TIMEOUT, STATE_CHECKMATE, |
int
|
STATE_STALEMATE, STATE_CHECK, or STATE_IN_PROGRESS. |
Source code in src/model/game/manager.py
get_valid_moves()
¶
Compute all legal moves available to the active player.
Returns:
| Type | Description |
|---|---|
List[Move]
|
List of legal Move instances for the active player. |
Source code in src/model/game/manager.py
make_move(move)
¶
Validate and execute a move, log it, and switch the active player.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
move
|
Move
|
Move instance to execute. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if the move was valid and successfully executed, False otherwise. |