diff --git a/src/__pycache__/plant.cpython-310.pyc b/src/__pycache__/plant.cpython-310.pyc index 21fa799..9fa6092 100644 Binary files a/src/__pycache__/plant.cpython-310.pyc and b/src/__pycache__/plant.cpython-310.pyc differ diff --git a/src/__pycache__/tractor.cpython-310.pyc b/src/__pycache__/tractor.cpython-310.pyc index 7bb4d92..bb7eed4 100644 Binary files a/src/__pycache__/tractor.cpython-310.pyc and b/src/__pycache__/tractor.cpython-310.pyc differ diff --git a/src/bfs.py b/src/bfs.py index f47144e..629f19c 100644 --- a/src/bfs.py +++ b/src/bfs.py @@ -13,7 +13,23 @@ class BFS: self.explored = [] def successor(self, state): - pass + pos_x, pos_y, rotation = state + options = [] + + if rotation == directions[0]: + states = [(pos_x, pos_y - block_size, directions[0]), (pos_x, pos_y, directions[270]), (pos_x, pos_y, directions[90])] + actions = ['F', 'L', 'R'] + elif rotation == directions[90]: + states = [(pos_x + block_size, pos_y, directions[90]), (pos_x, pos_y, directions[0]), (pos_x, pos_y, directions[180])] + actions = ['F', 'L', 'R'] + elif rotation == directions[180]: + states = [(pos_x, pos_y + block_size, directions[180]), (pos_x, pos_y, directions[90]), (pos_x, pos_y, directions[270])] + actions = ['F', 'L', 'R'] + elif rotation == directions[270]: + states = [(pos_x - block_size, pos_y, directions[270]), (pos_x, pos_y, directions[0]), (pos_x, pos_y, directions[180])] + actions = ['F', 'L', 'R'] + + return states, actions def search(self): pass