Search
Po tomto cvičení student
kuimaze2
02-search
kuimaze2.SearchProblem
SearchProblem
maps/easy_intro/easy_intro_1.png
>>> from kuimaze2 import SearchProblem, State >>> 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()
>>> env.render()
>>> start = env.get_start() >>> start State(r=0, c=1) >>> env.get_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, trans_cost = env.get_transition_result(start, actions[1]) >>> new_state State(r=0, c=2)
env.render()
>>> texts = {State(0,0): "S", State(0,1): "1"} >>> env.render(texts = texts, current_state=State(0,0), next_states=[State(1,0)])
example_search.py
Agent.find_path()
01-easy_search
agent.py