Movements
This class is used to manipulate actors' movements.
Source code in abses/move.py
to ¶
Move the actor to a specific location.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pos |
PatchCell | Coordinate | Literal['random']
|
The position to move to. If position is a Coordinate -a tuple of (row, col), it will be moved to the same layer. If pos |
required |
layer |
Optional[PatchModule]
|
The layer where the actor is located. |
None
|
Raises:
Type | Description |
---|---|
ABSESpyError
|
If the input layer is not consistent with the actor's layer. If the position is out of bounds. Or, if the pos is coordinate without layer. |
Source code in abses/move.py
off ¶
Remove the actor from the world.
Source code in abses/move.py
by ¶
Move the actor by a specific distance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
direction |
MovingDirection
|
The direction to move. It should be a direction string such as: "left", "right", "up", "down", "up left", "up right", "down left", "down right". |
required |
distance |
int
|
The distance to move toward the direction. |
1
|
Raises:
Type | Description |
---|---|
ABSESpyError
|
If the actor is not located on a cell, thus cannot move. |
ValueError
|
If the direction is invalid. |
Source code in abses/move.py
random ¶
Move the actor to a random location nearby.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prob |
Optional[str]
|
The probability to select a cell. |
None
|
kwargs |
Any
|
Passing keyword args to |
{}
|