games.nim.standalone_game¶
Standalone game implementation of Nim.
This script allows playing Nim without requiring the full Haive framework.
Classes¶
Manager for the Nim game. |
|
Move in the Nim game. |
|
State for the Nim game. |
|
UI for the Nim game. |
Functions¶
|
Run the Nim game. |
Parse command line arguments. |
Module Contents¶
- class games.nim.standalone_game.NimGameManager¶
Manager for the Nim game.
- static apply_move(state, move)¶
Apply a move to the current state.
- static check_game_status(state)¶
Check and update the game status.
- class games.nim.standalone_game.NimMove(/, **data)¶
Bases:
pydantic.BaseModel
Move in the Nim game.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- class games.nim.standalone_game.NimState(/, **data)¶
Bases:
pydantic.BaseModel
State for the Nim game.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- class games.nim.standalone_game.NimUI(delay=0.5)¶
UI for the Nim game.
Initialize the UI.
- Parameters:
delay (float)
- get_computer_move(state)¶
Generate a computer move.
- games.nim.standalone_game.main()¶
Run the Nim game.
- games.nim.standalone_game.parse_args()¶
Parse command line arguments.