added additional detection to farming
@@ -20,7 +20,15 @@ ARROW_RIGHT = 10
|
||||
ROCK_1 = 11
|
||||
ROCK_2 = 12
|
||||
ROCK_3 = 13
|
||||
BURGER = 14
|
||||
PAB1 = 15
|
||||
GOLDBAR = 16
|
||||
MAGINENT = 21
|
||||
CHEMTRANT = 22
|
||||
TENESENT = 23
|
||||
CIBUTRANT = 24
|
||||
ARTISENT = 25
|
||||
|
||||
|
||||
class Field:
|
||||
data_value_grid = []
|
||||
@@ -40,6 +48,9 @@ class Field:
|
||||
colors.append(RED)
|
||||
colors.append(PINK)
|
||||
colors.append(MAGINENT)
|
||||
colors.append(CHEMTRANT)
|
||||
colors.append(TENESENT)
|
||||
colors.append(CIBUTRANT)
|
||||
|
||||
|
||||
def __init__(self):
|
||||
@@ -75,8 +86,13 @@ class Field:
|
||||
ROCK_1: cv.imread("rock1.jpg", cv.IMREAD_COLOR),
|
||||
ROCK_2: cv.imread("rock2.jpg", cv.IMREAD_COLOR),
|
||||
ROCK_3: cv.imread("rock3.jpg", cv.IMREAD_COLOR),
|
||||
MAGINENT: cv.imread("maginent.jpg", cv.IMREAD_COLOR)
|
||||
|
||||
BURGER: cv.imread("burger.jpg", cv.IMREAD_COLOR),
|
||||
GOLDBAR: cv.imread("burger.jpg", cv.IMREAD_COLOR),
|
||||
PAB1: cv.imread("pab1.jpg", cv.IMREAD_COLOR),
|
||||
MAGINENT: cv.imread("maginent.jpg", cv.IMREAD_COLOR),
|
||||
CHEMTRANT: cv.imread("chemtrant.jpg", cv.IMREAD_COLOR),
|
||||
TENESENT: cv.imread("tenesent.jpg", cv.IMREAD_COLOR),
|
||||
CIBUTRANT: cv.imread("cibutrant.jpg", cv.IMREAD_COLOR)
|
||||
}
|
||||
|
||||
def reset(self):
|
||||
@@ -349,7 +365,7 @@ class Field:
|
||||
if state[e, i] == color and state[e, i + 1] == color:
|
||||
# third left upper
|
||||
if e - 1 >= 0 and i - 1 >= 0:
|
||||
if state[e - 1, i - 1] == color and (state[e, i - 1] >= 1 and state[e, i - 1] <= 5):
|
||||
if state[e - 1, i - 1] == color and (state[e, i - 1] in self.colors):
|
||||
print("upper left", color, e, i)
|
||||
src_pt = self.get_click_point(self.data_coordinates[e - 1, i - 1])
|
||||
dest_pt = self.get_click_point(self.data_coordinates[e, i - 1])
|
||||
@@ -357,7 +373,7 @@ class Field:
|
||||
return True
|
||||
# third left lower
|
||||
if e + 1 <= 7 and i - 1 >= 0:
|
||||
if state[e + 1, i - 1] == color and (state[e, i - 1] >= 1 and state[e, i - 1] <= 5):
|
||||
if state[e + 1, i - 1] == color and (state[e, i - 1] in self.colors):
|
||||
print("lower left", color, e, i)
|
||||
src_pt = self.get_click_point(self.data_coordinates[e + 1, i - 1])
|
||||
dest_pt = self.get_click_point(self.data_coordinates[e, i - 1])
|
||||
@@ -365,7 +381,7 @@ class Field:
|
||||
return True
|
||||
# third left with gap
|
||||
if i - 2 >= 0:
|
||||
if state[e, i - 2] == color and (state[e, i - 1] >= 1 and state[e, i - 1] <= 5):
|
||||
if state[e, i - 2] == color and (state[e, i - 1] in self.colors):
|
||||
print("left gap ", color, e, i)
|
||||
src_pt = self.get_click_point(self.data_coordinates[e, i - 2])
|
||||
dest_pt = self.get_click_point(self.data_coordinates[e, i - 1])
|
||||
@@ -373,7 +389,7 @@ class Field:
|
||||
return True
|
||||
# third right upper
|
||||
if e - 1 >= 0 and i + 2 <= 13:
|
||||
if state[e - 1, i + 2] == color and (state[e, i + 2] >= 1 and state[e, i + 2] <= 5):
|
||||
if state[e - 1, i + 2] == color and (state[e, i + 2] in self.colors):
|
||||
print("upper right", color, e, i)
|
||||
src_pt = self.get_click_point(self.data_coordinates[e - 1, i + 2])
|
||||
dest_pt = self.get_click_point(self.data_coordinates[e, i + 2])
|
||||
@@ -381,7 +397,7 @@ class Field:
|
||||
return True
|
||||
# third right lower
|
||||
if e + 1 <= 7 and i + 2 <= 13:
|
||||
if state[e + 1, i + 2] == color and (state[e, i + 2] >= 1 and state[e, i + 2] <= 5):
|
||||
if state[e + 1, i + 2] == color and (state[e, i + 2] in self.colors):
|
||||
print("upper lower", color, e, i)
|
||||
src_pt = self.get_click_point(self.data_coordinates[e + 1, i + 2])
|
||||
dest_pt = self.get_click_point(self.data_coordinates[e, i + 2])
|
||||
@@ -390,7 +406,7 @@ class Field:
|
||||
|
||||
# third right with gap
|
||||
if i + 3 <= 13:
|
||||
if state[e, i + 3] == color and (state[e, i + 2] >= 1 and state[e, i + 2] <= 5):
|
||||
if state[e, i + 3] == color and (state[e, i + 2] in self.colors):
|
||||
print("right gap ", color, e, i)
|
||||
src_pt = self.get_click_point(self.data_coordinates[e, i + 3])
|
||||
dest_pt = self.get_click_point(self.data_coordinates[e, i + 2])
|
||||
@@ -405,7 +421,7 @@ class Field:
|
||||
if state[e, i] == color and state[e + 1, i] == color:
|
||||
# third left upper
|
||||
if e - 1 >= 0 and i - 1 >= 0:
|
||||
if state[e - 1, i - 1] == color and (state[e - 1, i] >= 1 and state[e - 1, i] <= 5):
|
||||
if state[e - 1, i - 1] == color and (state[e - 1, i] in self.colors):
|
||||
print("upper left", color, e, i)
|
||||
src_pt = self.get_click_point(self.data_coordinates[e - 1, i - 1])
|
||||
dest_pt = self.get_click_point(self.data_coordinates[e - 1, i])
|
||||
@@ -413,7 +429,7 @@ class Field:
|
||||
return True
|
||||
# third left lower
|
||||
if e + 2 <= 7 and i - 1 >= 0:
|
||||
if state[e + 2, i - 1] == color and (state[e + 2, i] >= 1 and state[e + 2, i] <= 5):
|
||||
if state[e + 2, i - 1] == color and (state[e + 2, i] in self.colors):
|
||||
print("lower left", color, e, i)
|
||||
src_pt = self.get_click_point(self.data_coordinates[e + 2, i - 1])
|
||||
dest_pt = self.get_click_point(self.data_coordinates[e + 2, i])
|
||||
@@ -421,7 +437,7 @@ class Field:
|
||||
return True
|
||||
# third right upper
|
||||
if e - 1 >= 0 and i + 1 <= 13:
|
||||
if state[e - 1, i + 1] == color and (state[e - 1, i] >= 1 and state[e - 1, i] <= 5):
|
||||
if state[e - 1, i + 1] == color and (state[e - 1, i] in self.colors):
|
||||
print("upper right", color, e, i)
|
||||
src_pt = self.get_click_point(self.data_coordinates[e - 1, i + 1])
|
||||
dest_pt = self.get_click_point(self.data_coordinates[e - 1, i])
|
||||
@@ -429,7 +445,7 @@ class Field:
|
||||
return True
|
||||
# third right lower
|
||||
if e + 2 <= 7 and i + 1 <= 13:
|
||||
if state[e + 2, i + 1] == color and (state[e + 2, i] >= 1 and state[e + 2, i] <= 5):
|
||||
if state[e + 2, i + 1] == color and (state[e + 2, i] in self.colors):
|
||||
print("upper lower", color, e, i)
|
||||
src_pt = self.get_click_point(self.data_coordinates[e + 2, i + 1])
|
||||
dest_pt = self.get_click_point(self.data_coordinates[e + 2, i])
|
||||
@@ -437,7 +453,7 @@ class Field:
|
||||
return True
|
||||
# third upper with gap
|
||||
if e - 2 >= 0:
|
||||
if state[e - 2, i] == color and (state[e - 1, i] >= 1 and state[e - 1, i] <= 5):
|
||||
if state[e - 2, i] == color and (state[e - 1, i] in self.colors):
|
||||
print("upper gap ", color, e, i)
|
||||
src_pt = self.get_click_point(self.data_coordinates[e - 2, i])
|
||||
dest_pt = self.get_click_point(self.data_coordinates[e - 1, i])
|
||||
@@ -445,7 +461,7 @@ class Field:
|
||||
return True
|
||||
# third lower with gap
|
||||
if e + 3 <= 7:
|
||||
if state[e + 3, i] == color and (state[e + 2, i] >= 1 and state[e + 2, i] <= 5):
|
||||
if state[e + 3, i] == color and (state[e + 2, i] in self.colors):
|
||||
print("lower gap ", color, e, i)
|
||||
src_pt = self.get_click_point(self.data_coordinates[e + 3, i])
|
||||
dest_pt = self.get_click_point(self.data_coordinates[e + 2, i])
|
||||
|
||||
BIN
farm/bigbomb.jpg
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 2.1 KiB |
BIN
farm/burger.jpg
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
farm/chemtrant.jpg
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
farm/cibutrant.jpg
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
farm/goldbar.jpg
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
farm/pab1.jpg
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
farm/rock1.jpg
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 5.4 KiB |
BIN
farm/rock1.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
farm/tenesent.jpg
Normal file
|
After Width: | Height: | Size: 7.2 KiB |