From ed58517b821350a8f0065a18b301779d2e614e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Czeka=C5=84ski?= Date: Sun, 24 May 2020 17:12:35 +0200 Subject: [PATCH] Fix method reading from and adding examples to file --- src/AI/DecisionTrees/ExamplesManager.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/AI/DecisionTrees/ExamplesManager.py b/src/AI/DecisionTrees/ExamplesManager.py index 36dd08e..f9f3c08 100644 --- a/src/AI/DecisionTrees/ExamplesManager.py +++ b/src/AI/DecisionTrees/ExamplesManager.py @@ -117,7 +117,7 @@ class ExamplesManager: dstFromRest) examples.append(example) - + line = file.readline() file.close() return examples @@ -132,11 +132,12 @@ class ExamplesManager: example: SurvivalDTExample for example in examplesToAdd: - strToWrite = "{}|{}|{}|{}|{}|{}|{}".format(example.classification.name, + strToWrite = "\n{}|{}|{}|{}|{}|{}|{}".format(example.classification.name, example.hungerVal.name, example.thirstVal.name, example.staminaVal.name, example.distFromFood.name, example.distFromWater.name, example.distFromRestPlace.name) + file.write(strToWrite) file.close()