State¶
State(width, height, movement, objective, immunity=pmap(), phasing=pmap(), speed=pmap(), time_limit=pmap(), usage_limit=pmap(), agent=pmap(), appearance=pmap(), blocking=pmap(), collectible=pmap(), collidable=pmap(), cost=pmap(), damage=pmap(), dead=pmap(), exit=pmap(), health=pmap(), inventory=pmap(), key=pmap(), lethal_damage=pmap(), locked=pmap(), moving=pmap(), pathfinding=pmap(), portal=pmap(), position=pmap(), pushable=pmap(), requirable=pmap(), rewardable=pmap(), status=pmap(), turn=0, score=0, win=False, lose=False, message=None, turn_limit=None, seed=None)
dataclass
¶
Immutable ECS world state.
Attributes:
| Name | Type | Description |
|---|---|---|
width |
int
|
Grid width in tiles. |
height |
int
|
Grid height in tiles. |
movement |
BaseMovement
|
Movement function configuration. |
objective |
BaseObjective
|
Objective configuration. |
immunity |
PMap[EntityID, Immunity]
|
Effect component map. |
phasing |
PMap[EntityID, Phasing]
|
Effect component map. |
speed |
PMap[EntityID, Speed]
|
Effect component map. |
time_limit |
PMap[EntityID, TimeLimit]
|
Effect limiter map (remaining steps). |
usage_limit |
PMap[EntityID, UsageLimit]
|
Effect limiter map (remaining uses). |
agent |
PMap[EntityID, Agent]
|
Agent component map. |
appearance |
PMap[EntityID, Appearance]
|
Visual appearance component map. |
blocking |
PMap[EntityID, Blocking]
|
Obstacles that block movement. |
collectible |
PMap[EntityID, Collectible]
|
Entities that can be collected. |
collidable |
PMap[EntityID, Collidable]
|
Entities that can collide (triggering damage, cost, etc.). |
cost |
PMap[EntityID, Cost]
|
Entities that inflict movement cost. |
damage |
PMap[EntityID, Damage]
|
Entities that inflict damage on contact. |
dead |
PMap[EntityID, Dead]
|
Entities that are dead/incapacitated. |
exit |
PMap[EntityID, Exit]
|
Exit tiles/components. |
health |
PMap[EntityID, Health]
|
Entity health component map. |
inventory |
PMap[EntityID, Inventory]
|
Agent inventory component map. |
key |
PMap[EntityID, Key]
|
Keys that can unlock |
lethal_damage |
PMap[EntityID, LethalDamage]
|
Entities that inflict instant death on contact. |
locked |
PMap[EntityID, Locked]
|
Locked entities (doors, etc.). |
moving |
PMap[EntityID, Moving]
|
Entities with autonomous movement behavior. |
pathfinding |
PMap[EntityID, Pathfinding]
|
Entities with pathfinding behavior. |
portal |
PMap[EntityID, Portal]
|
Teleportation portal components. |
position |
PMap[EntityID, Position]
|
Entity position component map. |
pushable |
PMap[EntityID, Pushable]
|
Entities that can be pushed. |
requirable |
PMap[EntityID, Requirable]
|
Entities that must be collected to win if objective requires it. |
rewardable |
PMap[EntityID, Rewardable]
|
Entities that grant rewards when collected. |
status |
PMap[EntityID, Status]
|
Entity status effect component map. |
turn |
int
|
Current turn number. |
score |
int
|
Cumulative score. |
turn_limit |
int | None
|
Optional maximum number of turns allowed. When
set, reaching this number triggers a |
win |
bool
|
True if objective met. |
lose |
bool
|
True if losing condition met. |
message |
str | None
|
Optional status message for display. |
seed |
int | None
|
Base RNG seed for deterministic rendering or procedural systems. |
description
property
¶
Generates a persistent map describing the state's attributes. This includes all fields except for empty persistent maps.
Returns:
| Type | Description |
|---|---|
PMap[str, Any]
|
PMap[str, Any]: Persistent map of state attributes and their values. |