From d2d7a98a84bdfc7bffba7ba3d03261002a79991f Mon Sep 17 00:00:00 2001 From: jakzar Date: Sat, 11 May 2024 14:30:29 +0200 Subject: [PATCH] This: -changed decision from int to string values --- Condition.py | 2 +- Drzewo.py | 5 ++++- Tractor.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Condition.py b/Condition.py index e8d662a..2223c89 100644 --- a/Condition.py +++ b/Condition.py @@ -1,5 +1,6 @@ import random import Climate +import Ui class Condition: def __init__(self): @@ -44,4 +45,3 @@ class Condition: def getCondition(self): print(f"Aktualny czas: {Climate.time[self.currentTime]},opady: {Climate.rain[self.rain]},temperatura: {Climate.temperature[self.temperature]}, pora roku: {Climate.seasons[self.season]}") - \ No newline at end of file diff --git a/Drzewo.py b/Drzewo.py index 37da039..e40bf23 100644 --- a/Drzewo.py +++ b/Drzewo.py @@ -22,4 +22,7 @@ class Drzewo: plt.show() def makeDecision(self,values): action=self.tree.predict([values]) #0- nie podlewac, 1-podlewac - return action \ No newline at end of file + if(action==[0]): + return "Nie podlewac" + if(action==[1]): + return "Podlewac" \ No newline at end of file diff --git a/Tractor.py b/Tractor.py index df49982..872d246 100644 --- a/Tractor.py +++ b/Tractor.py @@ -71,7 +71,7 @@ class Tractor: attributes=[] attributes=attributes+slot_attributes+[self.waterLevel]+climate_attributes print("Decyzja czy podlac:",drzewo.makeDecision(attributes),"Atrybuty tego stanu to:",attributes) - #TODO SNAKE MOVE AND USING drzewo.makeDecision(attributes)for each slot. Also we need to cycle climate for each slot change by + #TODO SNAKE MOVE AND USING drzewo.makeDecision(attributes)for each slot. Also we need to cycle climate for each slot change #condition.cycle() #condition.getCondition() def turn_right(self):