Table of Contents

01 Intro and Search I

Learning outcomes

After this lab session, a student

Program

Bonus Quiz: Optimal plane travel plan

Getting to know the KUIMaze environment

>>> 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)

>>> 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)])

Mandatory Assignment 1: Searching in a Maze

Other

Homework