diff --git a/decision_tree/tree_as_txt.txt b/decision_tree/tree_as_txt.txt index aaa701a..9b5c043 100644 --- a/decision_tree/tree_as_txt.txt +++ b/decision_tree/tree_as_txt.txt @@ -16,28 +16,6 @@ | | | | | |--- feature_1 <= 2.50 | | | | | | |--- feature_0 <= 2.50 | | | | | | | |--- feature_1 <= 1.50 -| | | | | | | | |--- feature_2 <= 2.50 -| | | | | | | | | |--- class: 1 -| | | | | | | | |--- feature_2 > 2.50 -| | | | | | | | | |--- feature_4 <= 2.00 -| | | | | | | | | | |--- class: 1 -| | | | | | | | | |--- feature_4 > 2.00 -| | | | | | | | | | |--- class: 0 -| | | | | | | |--- feature_1 > 1.50 -| | | | | | | | |--- class: 0 -| | | | | | |--- feature_0 > 2.50 -| | | | | | | |--- feature_4 <= 2.50 -| | | | | | | | |--- class: 1 -| | | | | | | |--- feature_4 > 2.50 -| | | | | | | | |--- feature_2 <= 2.50 -| | | | | | | | | |--- class: 1 -| | | | | | | | |--- feature_2 > 2.50 -| | | | | | | | | |--- class: 0 -| | | | | |--- feature_1 > 2.50 -| | | | | | |--- feature_0 <= 3.50 -| | | | | | | |--- class: 0 -| | | | | | |--- feature_0 > 3.50 -| | | | | | | |--- feature_1 <= 3.50 | | | | | | | | |--- feature_4 <= 2.50 | | | | | | | | | |--- class: 1 | | | | | | | | |--- feature_4 > 2.50 @@ -45,8 +23,30 @@ | | | | | | | | | | |--- class: 1 | | | | | | | | | |--- feature_2 > 2.00 | | | | | | | | | | |--- class: 0 -| | | | | | | |--- feature_1 > 3.50 +| | | | | | | |--- feature_1 > 1.50 | | | | | | | | |--- class: 0 +| | | | | | |--- feature_0 > 2.50 +| | | | | | | |--- feature_2 <= 2.50 +| | | | | | | | |--- class: 1 +| | | | | | | |--- feature_2 > 2.50 +| | | | | | | | |--- feature_4 <= 2.50 +| | | | | | | | | |--- class: 1 +| | | | | | | | |--- feature_4 > 2.50 +| | | | | | | | | |--- class: 0 +| | | | | |--- feature_1 > 2.50 +| | | | | | |--- feature_1 <= 3.50 +| | | | | | | |--- feature_0 <= 3.50 +| | | | | | | | |--- class: 0 +| | | | | | | |--- feature_0 > 3.50 +| | | | | | | | |--- feature_4 <= 2.50 +| | | | | | | | | |--- class: 1 +| | | | | | | | |--- feature_4 > 2.50 +| | | | | | | | | |--- feature_2 <= 2.00 +| | | | | | | | | | |--- class: 1 +| | | | | | | | | |--- feature_2 > 2.00 +| | | | | | | | | | |--- class: 0 +| | | | | | |--- feature_1 > 3.50 +| | | | | | | |--- class: 0 | | | | |--- feature_3 > 4.50 | | | | | |--- class: 0 | |--- feature_4 > 3.50 @@ -59,13 +59,13 @@ | | | | | | |--- class: 1 | | | | |--- feature_3 > 3.50 | | | | | |--- feature_1 <= 2.50 -| | | | | | |--- feature_0 <= 2.50 -| | | | | | | |--- class: 0 -| | | | | | |--- feature_0 > 2.50 -| | | | | | | |--- feature_3 <= 4.50 -| | | | | | | | |--- class: 1 -| | | | | | | |--- feature_3 > 4.50 +| | | | | | |--- feature_3 <= 4.50 +| | | | | | | |--- feature_0 <= 2.50 | | | | | | | | |--- class: 0 +| | | | | | | |--- feature_0 > 2.50 +| | | | | | | | |--- class: 1 +| | | | | | |--- feature_3 > 4.50 +| | | | | | | |--- class: 0 | | | | | |--- feature_1 > 2.50 | | | | | | |--- class: 0 | | | |--- feature_4 > 4.50 @@ -76,13 +76,13 @@ | |--- feature_4 <= 1.50 | | |--- feature_1 <= 1.50 | | | |--- feature_2 <= 4.50 -| | | | |--- feature_0 <= 1.50 -| | | | | |--- class: 0 -| | | | |--- feature_0 > 1.50 -| | | | | |--- feature_3 <= 4.50 -| | | | | | |--- class: 1 -| | | | | |--- feature_3 > 4.50 +| | | | |--- feature_3 <= 4.50 +| | | | | |--- feature_0 <= 1.50 | | | | | | |--- class: 0 +| | | | | |--- feature_0 > 1.50 +| | | | | | |--- class: 1 +| | | | |--- feature_3 > 4.50 +| | | | | |--- class: 0 | | | |--- feature_2 > 4.50 | | | | |--- class: 0 | | |--- feature_1 > 1.50 diff --git a/decision_tree/tree_model b/decision_tree/tree_model index bf4e0f6..c9ec1be 100644 Binary files a/decision_tree/tree_model and b/decision_tree/tree_model differ diff --git a/genetic_algorithm/TSP.py b/genetic_algorithm/TSP.py index 12553e0..e1f851e 100644 --- a/genetic_algorithm/TSP.py +++ b/genetic_algorithm/TSP.py @@ -4,7 +4,7 @@ from decision_tree import decisionTree # klasa tworząca miasta czy też śmietniki class City: - def __init__(self, x, y, dist): + def __init__(self, x, y): self.x = x self.y = y # self.dist = distance diff --git a/last_map.nparr b/last_map.nparr new file mode 100644 index 0000000..c739475 Binary files /dev/null and b/last_map.nparr differ diff --git a/path_search_algorthms/a_star_controller.py b/path_search_algorthms/a_star_controller.py new file mode 100644 index 0000000..ee1294f --- /dev/null +++ b/path_search_algorthms/a_star_controller.py @@ -0,0 +1,26 @@ +import math +from path_search_algorthms import a_star +from settings import * + +def get_actions_by_coords(x, y, game): + # print('get_actions_by_coords') + # print(x, y, x/TILESIZE, y/TILESIZE) + offset_x, offset_y = game.camera.offset() + # print('offset ' + str(self.camera.offset())) + clicked_coords = [math.floor(x / TILESIZE) - offset_x, math.floor(y / TILESIZE) - offset_y] + # print(self.player.pos[0], self.player.pos[1], clicked_coords) + actions = a_star.search_path(math.floor(game.player.pos[0] / TILESIZE), + math.floor(game.player.pos[1] / TILESIZE), game.player.rotation(), + clicked_coords[0], clicked_coords[1], game.mapArray) + return actions + +def get_actions_for_target_coords(x, y, game): + actions = a_star.search_path( + math.floor(game.player.pos[0] / TILESIZE), + math.floor(game.player.pos[1] / TILESIZE), + game.player.rotation(), + x / TILESIZE, + y / TILESIZE, + game.mapArray + ) + return actions \ No newline at end of file