diff --git a/decisionTree/decision_tree_model.pkl b/decisionTree/decision_tree_model.pkl index 20bfa43..46c6a16 100644 Binary files a/decisionTree/decision_tree_model.pkl and b/decisionTree/decision_tree_model.pkl differ diff --git a/decisionTree/prepare.py b/decisionTree/prepare.py index a750c28..c0a17ad 100644 --- a/decisionTree/prepare.py +++ b/decisionTree/prepare.py @@ -12,7 +12,7 @@ y = pima.ToRemove X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=1) clf = DecisionTreeClassifier() -clf = clf.fit(X_train,y_train) +clf = clf.fit(X_train.values, y_train) joblib.dump(clf, 'decision_tree_model.pkl') diff --git a/domain/commands/vacuum_move_command.py b/domain/commands/vacuum_move_command.py index a10632b..258b0da 100644 --- a/domain/commands/vacuum_move_command.py +++ b/domain/commands/vacuum_move_command.py @@ -21,10 +21,12 @@ class VacuumMoveCommand(Command): if not self.world.accepted_move(end_x, end_y): return - if self.world.is_garbage_at(end_x, end_y): - if self.vacuum.get_container_filling() < 100: - self.vacuum.increase_container_filling() - self.world.dust[end_x][end_y].pop() + tmp = self.world.is_garbage_at(end_x, end_y) + if len(tmp) > 0: + for t in tmp: + if self.vacuum.get_container_filling() < 1000: + self.vacuum.increase_container_filling() + self.world.dust[end_x][end_y].remove(t) if self.world.is_docking_station_at(end_x, end_y): self.vacuum.dump_trash() diff --git a/domain/entities/garbage.py b/domain/entities/garbage.py index 2273cc7..f451dd1 100644 --- a/domain/entities/garbage.py +++ b/domain/entities/garbage.py @@ -6,6 +6,6 @@ class Garbage(Entity): super().__init__(x, y, "PEEL") self.wet = False self.size = 0 - self.props = [2,2,0,0,1,5,24,1] + self.props = [2,2,0,0,1,4,24,1] # TODO GARBAGE: add more properties diff --git a/domain/world.py b/domain/world.py index b46eb44..fd72812 100644 --- a/domain/world.py +++ b/domain/world.py @@ -32,11 +32,10 @@ class World: def is_obstacle_at(self, x: int, y: int) -> bool: return bool(self.obstacles[x][y]) - def is_garbage_at(self, x: int, y: int) -> bool: + def is_garbage_at(self, x: int, y: int): if len(self.dust[x][y]) == 0: - return False - tmp = evaluate([self.dust[x][y][0].props]) - return bool(tmp[0]) + return [] + return [i for i in self.dust[x][y] if evaluate([i.props])[0] == 1] def is_docking_station_at(self, x: int, y: int) -> bool: return bool(self.doc_station.x == x and self.doc_station.y == y) diff --git a/main.py b/main.py index 80fbe71..03e2830 100644 --- a/main.py +++ b/main.py @@ -150,7 +150,9 @@ def generate_world(tiles_x: int, tiles_y: int) -> World: world.add_entity(Entity(3, 4, "PLANT2")) world.add_entity(Entity(8, 8, "PLANT2")) world.add_entity(Entity(9, 3, "PLANT3")) + world.add_entity(Earring(9, 7)) world.add_entity(Earring(5, 5)) + world.add_entity(Earring(4, 6)) for x in range(world.width):