added fruit game support
This commit is contained in:
15
fruit.py
15
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':
|
||||
|
||||
Reference in New Issue
Block a user