From 60889a08c64a15c6e2317e48d99f99d4a1f386c4 Mon Sep 17 00:00:00 2001 From: Thaloria Date: Mon, 31 Oct 2022 16:04:42 +0100 Subject: [PATCH] added fruit game support --- fruit.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/fruit.py b/fruit.py index 1543066..4c2d437 100644 --- a/fruit.py +++ b/fruit.py @@ -111,9 +111,20 @@ class Fruit(GameBase): # cv.waitKey(150) return data_coords, screenshot + def point_in_rect(self, point): + for e in range(0, 7, 1): + for i in range(0, 11, 1): + x1, y1, w, h = self.data_coordinates[e][i] + x2, y2 = x1 + w, y1 + h + x, y = point + if x1 < x and x < x2: + if y1 < y and y < y2: + return e, i + return None, None + def find_patterns_and_valid_moves(self, state): - for e in range(0, 8, 1): - for i in range(0, 14, 1): + for e in range(0, 7, 1): + for i in range(0, 11, 1): if self.check_pairs(state, e, i): return if self.overlay.run_mode == 'stopped' or self.overlay.run_mode == 'paused':