updated ui elements

This commit is contained in:
2022-10-16 14:23:11 +02:00
parent 4d9f3faeba
commit 82a60026b2
3 changed files with 79 additions and 28 deletions

View File

@@ -83,7 +83,10 @@ class Crops:
def execute_main_loop(self):
while True:
if self.overlay.run_mode == 'stopped':
if self.overlay.run_mode == 'paused':
cv.waitKey(1)
continue
elif self.overlay.run_mode == 'stopped':
break
self.assess_playfield_and_make_move()
@@ -321,9 +324,9 @@ class Crops:
for x in range(0, 8, 1):
for y in range(0, 14, 1):
self.data_score_map[x, y] = self.score_for_attached_same_color_all_directions(state, x, y)
if self.overlay.run_mode == 'stopped':
if self.overlay.run_mode == 'stopped' or self.overlay.run_mode == 'paused':
break
if self.overlay.run_mode == 'stopped':
if self.overlay.run_mode == 'stopped' or self.overlay.run_mode == 'paused':
break
full_moves = []
@@ -341,18 +344,18 @@ class Crops:
path_option.append([x, y])
if len(path_option) >= 5:
full_moves.append((state[x, y], path_option))
if self.overlay.run_mode == 'stopped':
if self.overlay.run_mode == 'stopped' or self.overlay.run_mode == 'paused':
break
if self.data_score_map[x, y] >= 1:
path_option = [[x, y]]
self.find_next_same_color_all_directions_recursion2(state, x, y, path_option)
if len(path_option) >= 3:
reserve_moves.append((state[x, y], path_option))
if self.overlay.run_mode == 'stopped':
if self.overlay.run_mode == 'stopped' or self.overlay.run_mode == 'paused':
break
if self.overlay.run_mode == 'stopped':
if self.overlay.run_mode == 'stopped' or self.overlay.run_mode == 'paused':
break
if self.overlay.run_mode == 'stopped':
if self.overlay.run_mode == 'stopped' or self.overlay.run_mode == 'paused':
break
# print(self.data_score_map)
@@ -457,7 +460,7 @@ class Crops:
result = self.find_next_same_color_all_directions_recursion(state, direction[0], direction[1],
path_store, recursion_reminder,
look_for_ending)
if self.overlay.run_mode == 'stopped':
if self.overlay.run_mode == 'stopped' or self.overlay.run_mode == 'paused':
break
if result == STATUS_FOUND_CONTINUATION:
path_store.append(direction)
@@ -490,7 +493,7 @@ class Crops:
path_store.append(direction)
result = self.find_next_same_color_all_directions_recursion2(state, direction[0], direction[1],
path_store)
if self.overlay.run_mode == 'stopped':
if self.overlay.run_mode == 'stopped' or self.overlay.run_mode == 'paused':
break
if result == STATUS_FOUND_DEADEND:
return STATUS_FOUND_DEADEND