added strategy rnd
This commit is contained in:
@@ -35,6 +35,10 @@ STATUS_FOUND_CONTINUATION = "1"
|
||||
STATUS_FOUND_DEADEND = "2"
|
||||
STATUS_FOUND_ENDING = "3"
|
||||
|
||||
RAINBOW_STRATEGY = 11
|
||||
BIGBOMB_STRATEGY = 9
|
||||
ROCKET_STRATEGY = 7
|
||||
BOMB_STRATEGY = 5
|
||||
|
||||
class Field:
|
||||
data_value_grid = []
|
||||
@@ -57,6 +61,8 @@ class Field:
|
||||
self.data_score_map = np.zeros((8, 14), dtype=int)
|
||||
self.observation = np.zeros((8, 14), dtype=int)
|
||||
|
||||
self.current_strategy = RAINBOW_STRATEGY
|
||||
|
||||
# 230 to 2110 = 1883 / 14 = 134.5
|
||||
# 60 to 1130 = 1076 / 8 = 134.5
|
||||
dim = 134.5
|
||||
@@ -140,10 +146,10 @@ class Field:
|
||||
if self.check_for_button_and_execute(screenshot, self.reset_confirm):
|
||||
cv.waitKey(500)
|
||||
|
||||
color_list = (PURPLE, BLUE, RED, YELLOW, GREEN)
|
||||
color_list = [PURPLE, BLUE, RED, YELLOW, GREEN]
|
||||
random.shuffle(color_list)
|
||||
self.set_color_order(color_list)
|
||||
|
||||
self.current_strategy = random.choice([RAINBOW_STRATEGY, BIGBOMB_STRATEGY, ROCKET_STRATEGY, BOMB_STRATEGY])
|
||||
self.reset_counter = 0
|
||||
return
|
||||
else:
|
||||
@@ -198,6 +204,7 @@ class Field:
|
||||
offset_down = 58
|
||||
if self.check_for_button_and_execute(screenshot, self.next_level, offset_left, offset_down):
|
||||
self.set_color_order((GREEN, YELLOW, RED, BLUE, PURPLE))
|
||||
self.current_strategy = RAINBOW_STRATEGY
|
||||
cv.waitKey(500)
|
||||
screenshot = self.capture_window.get_screenshot()
|
||||
screenshot = screenshot[58:1134, 230:2113]
|
||||
@@ -255,18 +262,18 @@ class Field:
|
||||
for i in range(0, 14, 1):
|
||||
for explosive in self.explosives:
|
||||
if self.local_pos_check(state, e, i, 0, 0, explosive):
|
||||
dest_pt = self.get_click_point(self.data_coordinates[e, i])
|
||||
src_pt = self.get_click_point(self.data_coordinates[e, i])
|
||||
if self.local_pos_checks(state, e, i, 1, 0, self.colors):
|
||||
src_pt = self.get_click_point(self.data_coordinates[e + 1, i])
|
||||
dest_pt = self.get_click_point(self.data_coordinates[e + 1, i])
|
||||
self.move_tile(src_pt, dest_pt)
|
||||
elif self.local_pos_checks(state, e, i, 0, 1, self.colors):
|
||||
src_pt = self.get_click_point(self.data_coordinates[e, i + 1])
|
||||
dest_pt = self.get_click_point(self.data_coordinates[e, i + 1])
|
||||
self.move_tile(src_pt, dest_pt)
|
||||
elif self.local_pos_checks(state, e, i, -1, 0, self.colors):
|
||||
src_pt = self.get_click_point(self.data_coordinates[e - 1, i])
|
||||
dest_pt = self.get_click_point(self.data_coordinates[e - 1, i])
|
||||
self.move_tile(src_pt, dest_pt)
|
||||
elif self.local_pos_checks(state, e, i, 0, -1, self.colors):
|
||||
src_pt = self.get_click_point(self.data_coordinates[e, i - 1])
|
||||
dest_pt = self.get_click_point(self.data_coordinates[e, i - 1])
|
||||
self.move_tile(src_pt, dest_pt)
|
||||
else:
|
||||
continue
|
||||
@@ -330,13 +337,10 @@ class Field:
|
||||
|
||||
full_moves.sort(key=len, reverse=True)
|
||||
reserve_moves.sort(key=len, reverse=True)
|
||||
'''
|
||||
|
||||
'''
|
||||
|
||||
if len(full_dic) >= 1:
|
||||
for key in sorted(full_dic):
|
||||
if len(full_dic[key]) >= 10:
|
||||
if len(full_dic[key]) >= self.current_strategy:
|
||||
self.print_move(full_dic[key])
|
||||
self.execute_move(full_dic[key])
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user