This commit is contained in:
Paulina J 2019-06-03 13:37:21 +02:00
parent 66fe83073f
commit b4baf2236d
11 changed files with 19 additions and 4 deletions

View File

@ -1,6 +1,7 @@
from Plant import Plant from Plant import Plant
class Cucumber(Plant): class Cucumber(Plant):
name = "Cucumber"
is_alive = True is_alive = True
ttl = 10000 ttl = 10000
hydration = 40 hydration = 40

View File

@ -40,9 +40,13 @@ class Plant():
def ready(self): def ready(self):
pass pass
@property
def name(self):
pass
def get_stats(self): def get_stats(self):
return {"ttl": self.ttl, "is_alive": self.is_alive, "hydration": self.hydration, "soil_level": self.soil_level, return {"ttl": self.ttl, "is_alive": self.is_alive, "hydration": self.hydration, "soil_level": self.soil_level,
"ready": self.ready } "ready": self.ready, "name": self.name }
#np. touple'a z info czy żyje, ile ma wody i nawozu #np. touple'a z info czy żyje, ile ma wody i nawozu

@ -0,0 +1 @@
Subproject commit 6a36cc2dd0d2e35e707e94dc01d522b9566b806c

View File

@ -1,6 +1,7 @@
from Plant import Plant from Plant import Plant
class Tomato(Plant): class Tomato(Plant):
name = "Tomato"
is_alive = True is_alive = True
ttl = 12000 ttl = 12000
hydration = 41 hydration = 41

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -214,9 +214,17 @@ class Tractor(TreeClass):
parsed_data = data.decode().split() parsed_data = data.decode().split()
time.sleep(self.sleep_time) time.sleep(self.sleep_time)
writer.close() writer.close()
return {"ttl": int(parsed_data[0]), "is_alive": int(parsed_data[1]), "hydration": int(parsed_data[2]), "soil_level": int(parsed_data[3]), ttl = int(parsed_data[0])
"ready": int(parsed_data[4])} if parsed_data[1]=="True":
is_alive = True
else:
is_alive = False
hydration = int(parsed_data[2])
soil_level = int(parsed_data[3])
ready = int(parsed_data[4])
# return {"ttl": int(parsed_data[0]), "is_alive": ((parsed_data[1]=="True")?True:False), "hydration": int(parsed_data[2]), "soil_level": int(parsed_data[3]), "ready": int(parsed_data[4])}
return ({"ttl": ttl,"is_alive": is_alive,"hydration": hydration,"soil_level": soil_level,"ready": ready})
async def service(self): async def service(self):
plant_location = await self.look_at_plants(self.current_location) plant_location = await self.look_at_plants(self.current_location)
for i in plant_location: for i in plant_location: