After this lab session, a student
kuimaze2 environment;
03-search;
kuimaze2.SearchProblem environment;
SearchProblem environment, i.e. an instance of the class kuimaze2.SearchProblem, with the map given by the image maps/easy_intro/easy_intro_1.png:
>>> from kuimaze2 import SearchProblem >>> from kuimaze2.map_image import map_from_image >>> map_path = 'maps/easy_intro/easy_intro_1.png' >>> env = SearchProblem(map_from_image(map_path), graphics=True)
render() method:
>>> env.render()You should see the following image:
Keep the image window open for now, don't close it!
>>> start = env.get_start()
>>> start
State(r=0, c=1)
>>> env.get_goals() # Notice the different return type, this returns a list of possible goals
[State(r=2, c=4)]
>>> actions = env.get_actions(start)
>>> actions
[<Action.UP: 0>, <Action.RIGHT: 1>, <Action.DOWN: 2>, <Action.LEFT: 3>]
>>> new_state = env.get_transition_result(start, actions[1])
>>> new_state
(State(r=0, c=2), 1)
>>> texts = {State(0,0): "S", State(0,1): "1"}
>>> env.render(texts = texts)
>>> env.render(texts = texts, current_state=State(0,0), next_states=[State(1,0)])
env.render() again. Has the image changed in any way?
example_search.py and try to understand what is going on in it.
Agent.find_path() so that it returns your hard-coded path.
01-easy-search, see below.
agent.py module to task 01-easy_search. Observe the feedback you get from the evaluation script.
lab01quiz.
kuimaze2 environment work in your Python installation.
01-easy_search task (non-mandatory).
03-search task.