Important kuimaze2 datatypes

State

Class State encapsulates a position in a maze, i.e. a row r and a column c. You can create a State like this:

>>> from kuimaze2 import State
>>> state = State(1, 2)
>>> state
State(r=1, c=2)

You can easilly see what position the state represents. But in your algorithms you will almost never need to create a State instance yourself. (But you may need to create a State instance in your testing code.)

Action

Class Action is an Enum and represents 4 actions available for your agents to choose from:

>>> from kuimaze2 import Action
>>> Action
<enum 'Action'>
>>> actions = list(Action)
>>> actions
[<Action.UP: 0>, <Action.RIGHT: 1>, <Action.DOWN: 2>, <Action.LEFT: 3>]
>>> actions[0] == Action.UP
True

courses/be5b33kui/semtasks/kuimaze/02_datatypes.txt · Last modified: 2024/02/13 14:06 by xposik