diff --git a/bin/Classess/DecisionTree.py b/bin/Classess/DecisionTree.py new file mode 100644 index 0000000..8fc0a05 --- /dev/null +++ b/bin/Classess/DecisionTree.py @@ -0,0 +1,45 @@ +import pandas as pd +from sklearn.model_selection import train_test_split +from sklearn.tree import DecisionTreeClassifier +from sklearn.metrics import classification_report, confusion_matrix +from joblib import dump, load + + +class DecisionTree: + def __init__(self): + self.classifier = load('../../files/decision tree/classifier.joblib') + + +def Learning(): + # Uploading data from file + dataset = pd.read_csv("../../files/decision tree/database.csv") + + print(f'Shape: {dataset.shape}') + print(f'Head:\n{dataset.head()}') + + X = dataset.drop('decision', axis=1) + y = dataset['decision'] + + # Split data to training and test sets + X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.10) + + # Training + classifier = DecisionTreeClassifier() + classifier.fit(X_train, y_train) + + # Predictions test + y_pred = classifier.predict(X_test) + # print(y_pred) + + # my_dict = {'known': [1], 'power': [1], 'new': [1], 'location': [0], 'stable': [1], 'chain_reaction': [1]} + # s = pd.DataFrame.from_dict(my_dict) + # predict = self.classifier.predict(s) + # + # print(predict) + + print() + print(confusion_matrix(y_test, y_pred)) + print(classification_report(y_test, y_pred)) + + dump(classifier, '../../files/decision tree/classifier.joblib') + diff --git a/bin/Classess/Field.py b/bin/Classess/Field.py index 2df8c04..fc1c748 100644 --- a/bin/Classess/Field.py +++ b/bin/Classess/Field.py @@ -24,12 +24,16 @@ class Field(object): self.columns = 10 self.x_start = 5 self.y_start = 5 - self.state_of_cell_array = [[0 for i in range(3)] for j in range(200)] + # For red and green rectangles + # self.state_of_cell_array = [[0 for i in range(3)] for j in range(200)] + # Is on this position mine (True, False) self.field_state_array = [[False for i in range(self.rows)] for j in range(self.columns)] self.small_image_array = [[0 for i in range(self.rows)] for j in range(self.columns)] self.large_image_array = [[0 for i in range(self.rows)] for j in range(self.columns)] self.cell_expense = [0 for i in range(self.rows * self.columns)] - self.visited_mines = [] + # Array rows * columns, if on [x][y] mine, object mine will be in the array in this position + self.state_of_cell_array = [["None" for _ in range(self.rows)] for __ in range(self.columns)] + # self.visited_mines = [] # Modified by Artem to search in the status area self.canvas_small_images = [] @@ -47,7 +51,11 @@ class Field(object): bg='gray') self.large_image_canvas.place(x=FRAME_WIDTH + 5, y=3) - self.flag_img = PhotoImage(master=self.small_field_canvas, file="../../files/flag/Flaga.png") + self.flag_img = PhotoImage(master=self.small_field_canvas, file="../../files/flag/FlagRed.png") + self.flag_green_img = PhotoImage(master=self.small_field_canvas, file="../../files/flag/FlagGreen.png") + self.flag_yellow_img = PhotoImage(master=self.small_field_canvas, file="../../files/flag/FlagYellow.png") + self.flag_red_img = PhotoImage(master=self.small_field_canvas, file="../../files/flag/FlagRed.png") + self.flag_bleu_img = PhotoImage(master=self.small_field_canvas, file="../../files/flag/FlagBlue.png") # Clear Canvases def Moving(self): diff --git a/bin/Classess/Mine.py b/bin/Classess/Mine.py index c3b8bcd..2008b0c 100644 --- a/bin/Classess/Mine.py +++ b/bin/Classess/Mine.py @@ -1,7 +1,15 @@ class Mine: - def __init__(self, x, y): + def __init__(self, x, y, known, power, new, location, stable): self.array_x = x self.array_y = y self.status = True self.small_img = None self.large_img = None + + # Attributes for decision tree + self.known = known # 0 - 'no', 1 - 'yes' + self.power = power # 0 - 'no', 1 - 'yes' + self.new = new # 0 - 'no', 1 - 'yes' + self.location = location # 0 - 'standard', 1 - 'sand', 2 - 'water', 3 - 'swamp' + self.stable = stable # 0 - 'no', 1 - 'yes' + self.chain_reaction = 0 # 0 - 'no', 1 - 'yes' diff --git a/bin/Classess/__pycache__/DecisionTree.cpython-37.pyc b/bin/Classess/__pycache__/DecisionTree.cpython-37.pyc new file mode 100644 index 0000000..53af203 Binary files /dev/null and b/bin/Classess/__pycache__/DecisionTree.cpython-37.pyc differ diff --git a/bin/Classess/__pycache__/Field.cpython-37.pyc b/bin/Classess/__pycache__/Field.cpython-37.pyc index 50d164b..8681765 100644 Binary files a/bin/Classess/__pycache__/Field.cpython-37.pyc and b/bin/Classess/__pycache__/Field.cpython-37.pyc differ diff --git a/bin/Classess/__pycache__/Mine.cpython-37.pyc b/bin/Classess/__pycache__/Mine.cpython-37.pyc index 04a0e4d..4d6db72 100644 Binary files a/bin/Classess/__pycache__/Mine.cpython-37.pyc and b/bin/Classess/__pycache__/Mine.cpython-37.pyc differ diff --git a/bin/Main/LearnDecisionTree.py b/bin/Main/LearnDecisionTree.py new file mode 100644 index 0000000..2606a7d --- /dev/null +++ b/bin/Main/LearnDecisionTree.py @@ -0,0 +1,9 @@ +from bin.Classess.DecisionTree import Learning + + +def LearnDecisionTree(): + Learning() + + +if __name__ == '__main__': + LearnDecisionTree() diff --git a/bin/Main/__pycache__/__init__.cpython-37.pyc b/bin/Main/__pycache__/__init__.cpython-37.pyc index c31a950..7b5db13 100644 Binary files a/bin/Main/__pycache__/__init__.cpython-37.pyc and b/bin/Main/__pycache__/__init__.cpython-37.pyc differ diff --git a/bin/Main/__pycache__/main.cpython-37.pyc b/bin/Main/__pycache__/main.cpython-37.pyc index c088a33..0b20d9e 100644 Binary files a/bin/Main/__pycache__/main.cpython-37.pyc and b/bin/Main/__pycache__/main.cpython-37.pyc differ diff --git a/bin/Main/test.py b/bin/Main/test.py new file mode 100644 index 0000000..6f044e4 --- /dev/null +++ b/bin/Main/test.py @@ -0,0 +1,15 @@ +import pandas as pd + + +def main(): + my_dict = {'known': [1], 'power': [1], 'new': [1], 'location': 0, 'stable': [1], 'chain_reaction': [1]} + + s = pd.DataFrame.from_dict(my_dict) + + print(s) + + # data = {'col_1': [3, 2, 1, 0], 'col_2': ['a', 'b', 'c', 'd']} + # print(pd.DataFrame.from_dict(data)) + + +main() diff --git a/bin/main/main.py b/bin/main/main.py index d9ef498..a26f8ab 100644 --- a/bin/main/main.py +++ b/bin/main/main.py @@ -2,6 +2,7 @@ import os import random import time from tkinter import * +import pandas as pd from bin.Classess.Field import Field from bin.Classess.Mine import Mine @@ -10,6 +11,7 @@ from bin.Classess.Player import Player import bin.Classess.Node as nd import bin.Classess.Travel as tr from resources.Globals import * +from bin.Classess.DecisionTree import DecisionTree # WINDOW_X = 533 + 1200 # WINDOW_Y = 950 @@ -27,12 +29,16 @@ from resources.Globals import * player = Player() field = Field() travel = Travel() +decision_tree = DecisionTree() +# Globals fringe = [] explored = [] action_list = [] images_coord = [] +label = None + def Arrow(direction): image = "" @@ -62,18 +68,17 @@ def Fill(bool): print(travel.points_map) - for i in range(0, len(field.canvas_small_images)): images_coord.append(field.small_field_canvas.coords(field.canvas_small_images[i])) # print("Coords List: ", images_coord) nd.init_data(images_coord, field.cell_expense) - # Drawing red/green rectangles - for el in field.state_of_cell_array: - if el[0] != 0: - field.small_field_canvas.create_rectangle(el[0], el[1], el[0] + player.step - 2, - el[1] + player.step - 2, width=3, outline=el[2]) + # # Drawing red/green rectangles + # for el in field.state_of_cell_array: + # if el[0] != 0: + # field.small_field_canvas.create_rectangle(el[0], el[1], el[0] + player.step - 2, + # el[1] + player.step - 2, width=3, outline=el[2]) DrawingLargeImage() @@ -179,11 +184,11 @@ def CellDesignation(array, color): def Action(action): if action in ["Right", "Left", "Up", "space"]: Moving(action) - elif action in ["1", "2"]: - if action == "1": - CellDesignation(field.state_of_cell_array, "red") - else: - CellDesignation(field.state_of_cell_array, "green") + # elif action in ["1", "2"]: + # if action == "1": + # CellDesignation(field.state_of_cell_array, "red") + # else: + # CellDesignation(field.state_of_cell_array, "green") # Modified by Artem to search in the status area @@ -199,6 +204,42 @@ def create_action_list(states, index): create_action_list(states, states.index(state_parent)) +def MakeDecision(): + if player.current_array_x != 0 or player.current_array_y != 0: + mine = field.state_of_cell_array[player.current_array_y][player.current_array_x] + # print(field.state_of_cell_array) + # print(mine) + attributes_dict = {'known': [mine.known], 'power': [mine.power], 'new': [mine.new], 'location': [mine.location], + 'stable': [mine.stable], 'chain_reaction': [mine.chain_reaction]} + + attributes = f'{mine.known}; {mine.power}; {mine.new}; {mine.location}; {mine.stable}; {mine.chain_reaction}' + + global label_text + label_text += attributes + '\n' + + global label + label.config(text=label_text) + field.win.update() + + data_frame = pd.DataFrame.from_dict(attributes_dict) + predict = decision_tree.classifier.predict(data_frame) + + return predict + + +def MarkMine(prediction): + if prediction == 0: + DrawFlag(field.flag_green_img) + if prediction == 1: + DrawFlag(field.flag_yellow_img) + if prediction == 2: + DrawFlag(field.flag_red_img) + if prediction == 3: + DrawFlag(field.flag_bleu_img) + + field.win.update() + + def MouseClickEvent(track): global fringe global explored @@ -230,7 +271,6 @@ def MouseClickEvent(track): explored.clear() action_list.clear() fringe = nd.graph_search_A(fringe, explored, node.state, end_position) - # fringe = nd.graph_search(fringe, explored, node.state, end_position) states = [] goal_all = [] @@ -249,80 +289,39 @@ def MouseClickEvent(track): create_action_list(states, -1) - # for i in range(0, len(fringe)): - # print('Node{} = State: {} {}, Parent: {} {} {}, Action: {}'.format(i + 1, fringe[i].state.coord, fringe[i].state.direction, fringe[i].parent[0], fringe[i].parent[1], fringe[i].parent[2], fringe[i].action)) - - # print(action_list) - # Start moving AutoMove() - DrawFlag() + + # Decision by tree + prediction = MakeDecision() + # Draw the right flag + MarkMine(prediction) time.sleep(SLEEP_AFTER_CHECK_MINE) - # start_position = field.small_field_canvas.coords(player.image_canvas_id) - # end_position = [] - # - # # print("Pierwsza pozycja: {} {}".format(start_position[0], start_position[1])) - # - # for i in range(0, len(field.canvas_small_images)): - # img_coords = field.small_field_canvas.coords(field.canvas_small_images[i]) - # if (img_coords[0] <= event.x and event.x <= img_coords[0] + IMAGE_SIZE) and (img_coords[1] <= event.y and event.y <= img_coords[1] + IMAGE_SIZE): - # end_position = img_coords - # print("Color cost: ", field.cell_expense[i]) - # - # # if len(end_position) == 2: - # # print("Koncowa pozycja: {} {}".format(end_position[0], end_position[1])) - # - # node = nd.Node() - # if len(fringe) == 0: - # node.state.coord = start_position - # node.state.direction = "east" - # else: - # states = [] - # for k in range(0, len(fringe)): - # new_state = fringe[k].state.coord - # states.append(new_state) - # start_node = fringe[-1] - # - # node.state.coord = start_node.state.coord - # node.state.direction = start_node.state.direction - # - # fringe.clear() - # explored.clear() - # action_list.clear() - # fringe = nd.graph_search_A(fringe, explored, node.state, end_position) - # # fringe = nd.graph_search(fringe, explored, node.state, end_position) - # - # states = [] - # goal_all = [] - # for i in range(0, len(fringe)): - # new_state = [fringe[i].state.coord, fringe[i].state.direction] - # states.append(new_state) - # if end_position[0] == fringe[i].state.coord[0] and end_position[1] == fringe[i].state.coord[1]: - # goal_all.append(fringe[i]) - # - # elem_min = goal_all[0] - # for i in range(1, len(goal_all)): - # if elem_min.priority > goal_all[i].priority: - # elem_min = goal_all[i] - # index = fringe.index(elem_min) - # fringe = fringe[:index + 1] - # - # create_action_list(states, -1) - # - # # for i in range(0, len(fringe)): - # # print('Node{} = State: {} {}, Parent: {} {} {}, Action: {}'.format(i + 1, fringe[i].state.coord, fringe[i].state.direction, fringe[i].parent[0], fringe[i].parent[1], fringe[i].parent[2], fringe[i].action)) - # - # print(action_list) - # - # - # - # # Start moving - # AutoMove() +# Check in which locations is mine +def CheckLocation(x, y): + # Add x + y like strings that create xy number + temp_x = str(x) + temp_y = str(y) + position_str = temp_x + temp_y + position = int(position_str) + + color_number = -1 + if field.cell_expense[position] == standard_cell_cost: + color_number = 0 + elif field.cell_expense[position] == sand_cell_cost: + color_number = 1 + elif field.cell_expense[position] == water_cell_cost: + color_number = 2 + elif field.cell_expense[position] == swamp_cell_cost: + color_number = 3 + + return color_number +# Add mines on the field and to arrays def PutMines(mines_array): counter = 0 @@ -339,9 +338,18 @@ def PutMines(mines_array): if x == 0 and y == 0: continue else: - mine = Mine(x, y) + known = random.randint(0, 1) + power = random.randint(1, 10) + new = random.randint(0, 1) + location = CheckLocation(x, y) + stable = random.randint(0, 1) + + mine = Mine(x, y, known, power, new, location, stable) mines_array.append(mine) + # Add mine to array at the right position + field.state_of_cell_array[x][y] = mine + field.field_state_array[x][y] = True counter += 1 @@ -391,8 +399,8 @@ def MinesInArrays(mines_array, directory, imgs_array, bool_mines_coord): field.mines_coord.append([mines_array[i].array_x, mines_array[i].array_y]) -def DrawFlag(): - field.small_field_canvas.create_image(player.current_x, player.current_y, anchor=NW, image=field.flag_img) +def DrawFlag(image): + field.small_field_canvas.create_image(player.current_x, player.current_y, anchor=NW, image=image) # def IsItMine(): @@ -439,15 +447,14 @@ def DrawRectangle(): elif field.cell_expense[i] == swamp_cell_cost: color = "green4" if color != "None": - field.small_field_canvas.create_rectangle(x, y, x + IMAGE_SIZE + 2, y + IMAGE_SIZE + 2, width=2, outline=color) + field.small_field_canvas.create_rectangle(x, y, x + IMAGE_SIZE + 2, y + IMAGE_SIZE + 2, width=2, + outline=color) x += player.step if x + IMAGE_SIZE + 2 > field.width: x = 4 y += player.step - - def AddCostCellsToArray(amount, cost): counter = 0 while counter < amount: @@ -461,7 +468,9 @@ def CostingOfCells(): AddCostCellsToArray(amount_of_sand_cells, sand_cell_cost) AddCostCellsToArray(amount_of_water_cells, water_cell_cost) AddCostCellsToArray(amount_of_swamp_cells, swamp_cell_cost) - AddCostCellsToArray(field.rows * field.columns - (amount_of_sand_cells + amount_of_water_cells + amount_of_swamp_cells), standard_cell_cost) + AddCostCellsToArray( + field.rows * field.columns - (amount_of_sand_cells + amount_of_water_cells + amount_of_swamp_cells), + standard_cell_cost) # Draw rectangles DrawRectangle() @@ -469,8 +478,9 @@ def CostingOfCells(): def click_button(): btn.destroy() - label = Label(field.win, text="Wait...\nAI conquers the world...", fg='black', font="20") - label.place(x=50, y=570) + global label + label = Label(field.win, text="Wait...\nAI conquers the world...", fg='black', font="20", bg='gray') + label.place(x=10, y=560) field.win.update() track = tr.genetic_algorithm(travel.points_map) @@ -480,6 +490,41 @@ def click_button(): MouseClickEvent(track) +# Check if there mines near and if, mark it +def CheckForMinesNear(x, y): + if x > 0: + if field.state_of_cell_array[x - 1][y] != "None": + # Mark by chain reaction current mine + field.state_of_cell_array[x][y].chain_reaction = 1 + # Mark by chain reaction mine that near + field.state_of_cell_array[x - 1][y].chain_reaction = 1 + if x < 9: + if field.state_of_cell_array[x + 1][y] != "None": + # Mark by chain reaction current mine + field.state_of_cell_array[x][y].chain_reaction = 1 + # Mark by chain reaction mine that near + field.state_of_cell_array[x + 1][y].chain_reaction = 1 + if y > 0: + if field.state_of_cell_array[x][y - 1] != "None": + # Mark by chain reaction current mine + field.state_of_cell_array[x][y].chain_reaction = 1 + # Mark by chain reaction mine that near + field.state_of_cell_array[x][y - 1].chain_reaction = 1 + if y < 9: + if field.state_of_cell_array[x][y + 1] != "None": + # Mark by chain reaction current mine + field.state_of_cell_array[x][y].chain_reaction = 1 + # Mark by chain reaction mine that near + field.state_of_cell_array[x][y + 1].chain_reaction = 1 + + +def CheckForChainReaction(): + for x in range(field.columns): + for y in range(field.rows): + if field.state_of_cell_array[x][y] != "None": + CheckForMinesNear(x, y) + + def main(): # Creating the main window of an application win_size = f'{WINDOW_X}x{WINDOW_Y}' @@ -487,6 +532,7 @@ def main(): field.win.configure(bg='gray') field.win.geometry(win_size) print(f'Amount of mines: {AMOUNT_OF_MINES}') + global btn btn = Button(field.win, text="Search for mines", # текст кнопки @@ -498,13 +544,19 @@ def main(): command=click_button ) - btn.place(x=50, y=570) + btn.place(x=10, y=560) # Create array with mines objects mines_array = [] + + CostingOfCells() + # Put mines on coordinates PutMines(mines_array) + CheckForChainReaction() + + # Add images of mines in arrays MinesInArrays(mines_array, "../../files/small_mines_images", field.small_image_array, True) MinesInArrays(mines_array, "../../files/large_mines_images", field.large_image_array, False) @@ -514,8 +566,6 @@ def main(): large_directory = "../../files/large_images" ImagesInArray(large_directory, field.large_image_array) - CostingOfCells() - # Add arrow image to Player class images = [] for file in os.listdir("../../files/arrow"): @@ -540,6 +590,7 @@ def main(): # Binding keyboard press to function # field.win.bind("", Action) # field.small_field_canvas.bind("", MouseClickEvent) + # Starting mainloop for window field.win.mainloop() diff --git a/files/decision tree/classifier.joblib b/files/decision tree/classifier.joblib new file mode 100644 index 0000000..4f6382f Binary files /dev/null and b/files/decision tree/classifier.joblib differ diff --git a/files/decision tree/database.csv b/files/decision tree/database.csv new file mode 100644 index 0000000..10b4be4 --- /dev/null +++ b/files/decision tree/database.csv @@ -0,0 +1,641 @@ +known,power,new,location,stable,chain_reaction,decision +1,1,1,0,1,1,1 +1,1,1,0,1,0,2 +1,1,1,0,0,1,1 +1,1,1,0,0,0,2 +1,1,0,0,1,1,1 +1,1,0,0,1,0,2 +1,1,0,0,0,1,1 +1,1,0,0,0,0,2 +1,1,1,1,1,1,1 +1,1,1,1,1,0,2 +1,1,1,1,0,1,1 +1,1,1,1,0,0,2 +1,1,0,1,1,1,1 +1,1,0,1,1,0,2 +1,1,0,1,0,1,1 +1,1,0,1,0,0,2 +1,1,1,2,1,1,1 +1,1,1,2,1,0,2 +1,1,1,2,0,1,1 +1,1,1,2,0,0,2 +1,1,0,2,1,1,1 +1,1,0,2,1,0,2 +1,1,0,2,0,1,1 +1,1,0,2,0,0,2 +1,1,1,3,1,1,1 +1,1,1,3,1,0,2 +1,1,1,3,0,1,1 +1,1,1,3,0,0,2 +1,1,0,3,1,1,1 +1,1,0,3,1,0,2 +1,1,0,3,0,1,1 +1,1,0,3,0,0,2 +1,2,1,0,1,1,1 +1,2,1,0,1,0,2 +1,2,1,0,0,1,1 +1,2,1,0,0,0,2 +1,2,0,0,1,1,1 +1,2,0,0,1,0,2 +1,2,0,0,0,1,1 +1,2,0,0,0,0,2 +1,2,1,1,1,1,1 +1,2,1,1,1,0,2 +1,2,1,1,0,1,1 +1,2,1,1,0,0,2 +1,2,0,1,1,1,1 +1,2,0,1,1,0,2 +1,2,0,1,0,1,1 +1,2,0,1,0,0,2 +1,2,1,2,1,1,1 +1,2,1,2,1,0,2 +1,2,1,2,0,1,1 +1,2,1,2,0,0,2 +1,2,0,2,1,1,1 +1,2,0,2,1,0,2 +1,2,0,2,0,1,1 +1,2,0,2,0,0,2 +1,2,1,3,1,1,1 +1,2,1,3,1,0,2 +1,2,1,3,0,1,1 +1,2,1,3,0,0,2 +1,2,0,3,1,1,1 +1,2,0,3,1,0,2 +1,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1,0,1,1,1 +0,10,1,0,1,0,1 +0,10,1,0,0,1,1 +0,10,1,0,0,0,1 +0,10,0,0,1,1,1 +0,10,0,0,1,0,1 +0,10,0,0,0,1,1 +0,10,0,0,0,0,1 +0,10,1,1,1,1,1 +0,10,1,1,1,0,1 +0,10,1,1,0,1,1 +0,10,1,1,0,0,1 +0,10,0,1,1,1,1 +0,10,0,1,1,0,1 +0,10,0,1,0,1,1 +0,10,0,1,0,0,1 +0,10,1,2,1,1,1 +0,10,1,2,1,0,1 +0,10,1,2,0,1,1 +0,10,1,2,0,0,1 +0,10,0,2,1,1,1 +0,10,0,2,1,0,1 +0,10,0,2,0,1,1 +0,10,0,2,0,0,1 +0,10,1,3,1,1,1 +0,10,1,3,1,0,1 +0,10,1,3,0,1,1 +0,10,1,3,0,0,1 +0,10,0,3,1,1,1 +0,10,0,3,1,0,1 +0,10,0,3,0,1,1 +0,10,0,3,0,0,1 diff --git a/files/flag/FlagBlue.png b/files/flag/FlagBlue.png new file mode 100644 index 0000000..f67845f Binary files /dev/null and b/files/flag/FlagBlue.png differ diff --git a/files/flag/FlagGreen.png b/files/flag/FlagGreen.png new file mode 100644 index 0000000..ac4608b Binary files /dev/null and b/files/flag/FlagGreen.png differ diff --git a/files/flag/FlagRed.png b/files/flag/FlagRed.png new file mode 100644 index 0000000..5b86a02 Binary files /dev/null and b/files/flag/FlagRed.png differ diff --git a/files/flag/FlagYellow.png b/files/flag/FlagYellow.png new file mode 100644 index 0000000..a8a980e Binary files /dev/null and b/files/flag/FlagYellow.png differ diff --git a/files/flag/Flaga.png b/files/flag/Flaga.png deleted file mode 100644 index 3e6bba9..0000000 Binary files a/files/flag/Flaga.png and /dev/null differ diff --git a/resources/Globals.py b/resources/Globals.py index 10c2a92..640b612 100644 --- a/resources/Globals.py +++ b/resources/Globals.py @@ -14,7 +14,7 @@ MAX_AMOUNT_OF_MINES = 11 AMOUNT_OF_MINES = random.randint(MIN_AMOUNT_OF_MINES, MAX_AMOUNT_OF_MINES) DELAY_TIME = 0.2 -SLEEP_AFTER_CHECK_MINE = 1 +SLEEP_AFTER_CHECK_MINE = 2 STEP = IMAGE_SIZE + 5 @@ -36,3 +36,6 @@ NUMBER_OF_INDIVIDUALS_FOR_DUEL = 4 NUMBER_OF_POINTS_PERMUTATION = 10 PERCENT_OF_MUTATION = 0.01 PERCENT_OF_OUTGOING_INDIVIDUALS = 0.03 + + +label_text = "" diff --git a/resources/__pycache__/Globals.cpython-37.pyc b/resources/__pycache__/Globals.cpython-37.pyc index 97b57fc..a28ab99 100644 Binary files a/resources/__pycache__/Globals.cpython-37.pyc and b/resources/__pycache__/Globals.cpython-37.pyc differ