Players¶
Role: Factory and container for a pair of QSeaBattle players. Location:
Q_Sea_Battle.players_base.Players
Constructor¶
| Parameter | Type | Description |
|---|---|---|
| game_layout | Optional[GameLayout], constraint: None or instance of Q_Sea_Battle.game_layout.GameLayout, shape: scalar |
Optional shared configuration; if None, a default GameLayout is created. |
Preconditions
- Not specified.
Postconditions
self.game_layoutis set to the providedgame_layoutif not None, otherwise to a newly createdGameLayout.
Errors
- Not specified.
Example
from Q_Sea_Battle.players_base import Players
players_facade = Players()
player_a, player_b = players_facade.players()
Public Methods¶
players¶
Create the concrete Player A and Player B instances using the shared GameLayout.
Parameters
- None.
Returns
- Tuple["PlayerA", "PlayerB"], constraint: 2-tuple of player instances, shape: (2,).
Errors
- Not specified.
Example
from Q_Sea_Battle.players_base import Players
p = Players()
player_a, player_b = p.players()
reset¶
Reset any internal state across both players.
Parameters
- None.
Returns
- None, constraint: always
None, shape: scalar.
Errors
- Not specified.
Example
from Q_Sea_Battle.players_base import Players
p = Players()
p.reset()
Data & State¶
- game_layout: GameLayout, constraint: instance of
Q_Sea_Battle.game_layout.GameLayout, shape: scalar; shared configuration used by both players.
Planned (design-spec)¶
- Not specified.
Deviations¶
- Not specified.
Notes for Contributors¶
- This module also provides deprecated attribute access for
PlayerAandPlayerBvia module-level__getattr__, emittingDeprecationWarningand caching the resolved symbols inglobals().
Related¶
Q_Sea_Battle.player_base_a.PlayerA(concrete baseline implementation imported as_PlayerAinternally)Q_Sea_Battle.player_base_b.PlayerB(concrete baseline implementation imported as_PlayerBinternally)Q_Sea_Battle.game_layout.GameLayout
Changelog¶
- Not specified.