Warning
This page is located in archive. Go to the latest version of this course pages.

InfEasyMaze

Prostředí kuimaze.InfEasyMaze budeme používat pro hledání cesty v bludišti. Bude použito pro nepovinnou úlohu 01-easy_search a první povinnou úlohu 03-search. Pro práci s prostředím je třeba provést následující kroky:

  • Načíst prostředí:

import kuimaze

  • Vytvořit instanci třídy s vybranou mapou:

MAP = 'maps/easy_intro/easy_intro_1.bmp'
env = kuimaze.InfEasyMaze(map_image=MAP)

  • Inicializovat prostředí:

observation = env.reset() # returns start_pos, goal_pos
start = observation[0][0:2] # start position, tuple (int, int)
goal = observation[1][0:2] # goal position, tuple (int, int)

  • Komunikovat s prostředím:

positions_with_costs = env.expand(position) # list of lists [pos,cost], i.e. [[pos1, cost1],[pos2,cost2],...]
new_position = positions_with_costs[0][0] # tuple (int, int)
cost = positions_with_costs[0][1] # cost to get from position to new_position

Pro zobrazení prostředí zavolejte:

env.render()

courses/b3b33kui/kuimaze/1_infeasymaze.txt · Last modified: 2023/03/11 16:05 by xposik