Reprezentacja_wiedzy #1

Merged
s481838 merged 6 commits from Reprezentacja_wiedzy into master 2024-03-26 00:23:07 +01:00
2 changed files with 16 additions and 9 deletions
Showing only changes of commit ffb64ccbc0 - Show all commits

View File

@ -22,14 +22,16 @@ class Tractor:
if plant1 is None: if plant1 is None:
tile.randomizeContent() tile.randomizeContent()
# sprobuj zasadzic cos # sprobuj zasadzic cos
print("Tarctor planted something")
elif plant1.growth_level == 100: elif plant1.growth_level == 100:
tile.plant = None tile.plant = None
ground.nutrients -= 40 ground.nutrients_level -= 40
ground.water -= 40 ground.water_level -= 40
print("Tractor collected something")
else: else:
plant1.try_to_grow() plant1.try_to_grow(50,50) #mozna dostosowac jeszcze
ground.nutrients -= 11 ground.nutrients_level -= 11
ground.water -= 11 ground.water_level -= 11
if ground.pest: if ground.pest:
# traktor pozbywa sie szkodnikow # traktor pozbywa sie szkodnikow
if plant1.plant_type == self.cypermetryna.plant_type: if plant1.plant_type == self.cypermetryna.plant_type:
@ -50,7 +52,9 @@ class Tractor:
t = "Tractor used Metazachlor" t = "Tractor used Metazachlor"
print(t) print(t)
ground.weed = False ground.weed = False
if ground.water < plant1.water_requirements: if ground.water_level < plant1.water_requirements:
ground.water += 20 ground.water_level += 20
if ground.nutrients < plant1.nutrients_requirements: print("Tractor watered the plant")
ground.nutrients += 20 if ground.nutrients_level < plant1.nutrients_requirements:
ground.nutrients_level += 20
print("Tractor added some nutrients")

View File

@ -15,6 +15,9 @@ class Plant:
if self.growth_level+i > 100: if self.growth_level+i > 100:
i = 100 - self.growth_level i = 100 - self.growth_level
self.growth_level += i self.growth_level += i
print("The plant is growing")
else:
print("Unable to grow due to bad condition of the ground")
# more properties # more properties