image_recognition #5

Merged
s473558 merged 23 commits from image_recognition into master 2023-06-12 16:25:59 +02:00
Showing only changes of commit d3ffe50c91 - Show all commits

View File

@ -70,7 +70,7 @@ class Game:
clock = pygame.time.Clock() clock = pygame.time.Clock()
move_tractor_event = pygame.USEREVENT + 1 move_tractor_event = pygame.USEREVENT + 1
pygame.time.set_timer(move_tractor_event, 150) # tractor moves every 1000 ms pygame.time.set_timer(move_tractor_event, 100) # tractor moves every 1000 ms
tractor_next_moves = [] tractor_next_moves = []
astar_search_object = astar_search.Search(self.cell_size, self.cell_number) astar_search_object = astar_search.Search(self.cell_size, self.cell_number)
@ -108,7 +108,7 @@ class Game:
angles = {0: 'UP', 90: 'RIGHT', 270: 'LEFT', 180: 'DOWN'} angles = {0: 'UP', 90: 'RIGHT', 270: 'LEFT', 180: 'DOWN'}
#bandaid to know about stones #bandaid to know about stones
tractor_next_moves = astar_search_object.astarsearch( tractor_next_moves = astar_search_object.astarsearch(
[self.tractor.x, self.tractor.y, angles[self.tractor.angle]], [random_x, random_y], self.stone_body, self.flower_body) [self.tractor.x, self.tractor.y, angles[self.tractor.angle]], [random_x, random_y], self.blocks.stones, self.flower_body)
else: else:
self.tractor.move(tractor_next_moves.pop(0)[0], self.cell_size, self.cell_number) self.tractor.move(tractor_next_moves.pop(0)[0], self.cell_size, self.cell_number)
elif event.type == QUIT: elif event.type == QUIT: