From 74c06fb6e9d1addfef5cdbf43c22ae37fded81a2 Mon Sep 17 00:00:00 2001 From: Thaloria Date: Fri, 14 Oct 2022 16:57:59 +0200 Subject: [PATCH] added color switch and reset trigger --- crop/Field_Representation_crop.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crop/Field_Representation_crop.py b/crop/Field_Representation_crop.py index 1e46cde..0fdf4ee 100644 --- a/crop/Field_Representation_crop.py +++ b/crop/Field_Representation_crop.py @@ -172,6 +172,7 @@ class Field: # last board state is same as actual if mse(new_observation, self.observation) == 0.0: # no movement detected -> blow explosives or reset + self.reset_counter += 1 if self.reset_counter >= 3: screenshot = self.capture_window.get_screenshot() @@ -188,7 +189,9 @@ class Field: self.set_color_order((GREEN, YELLOW, RED, BLUE, PURPLE)) self.colors_at_standard = True self.reset_counter = 0 - cv.waitKey(500) + return + self.detonate_explosive_when_stuck(new_observation) + return self.find_patterns_and_valid_moves(new_observation) self.observation = new_observation