Reprezentacja_wiedzy #1
@ -1,24 +1,56 @@
|
|||||||
|
from crop_protection_product import CropProtectionProduct
|
||||||
|
|
||||||
|
|
||||||
class Tractor:
|
class Tractor:
|
||||||
x = None
|
x = None
|
||||||
y = None
|
y = None
|
||||||
image = None
|
image = None
|
||||||
|
cypermetryna = CropProtectionProduct("pests", "cereal")
|
||||||
|
diflufenikan = CropProtectionProduct("weeds", "cereal")
|
||||||
|
spirotetramat = CropProtectionProduct("pests", "fruit")
|
||||||
|
oksadiargyl = CropProtectionProduct("weeds", "fruit")
|
||||||
|
spinosad = CropProtectionProduct("pests", "vegetable")
|
||||||
|
metazachlor = CropProtectionProduct("weeds", "vegetable")
|
||||||
# etc
|
# etc
|
||||||
|
|
||||||
def __init__(self, x, y):
|
def __init__(self, x, y):
|
||||||
self.x = x
|
self.x = x
|
||||||
self.y = y
|
self.y = y
|
||||||
self.image = 'resources/images/tractor.png'
|
self.image = 'resources/images/tractor.png'
|
||||||
|
|
||||||
def work_on_field(self, ground, plant):
|
def work_on_field(self, tile, ground, plant1):
|
||||||
if plant is None:
|
if plant1 is None:
|
||||||
pass # zasadz cos
|
tile.randomizeContent()
|
||||||
if ground.pest == True:
|
# sprobuj zasadzic cos
|
||||||
|
elif plant1.growth_level == 100:
|
||||||
|
tile.plant = None
|
||||||
|
ground.nutrients -= 40
|
||||||
|
ground.water -= 40
|
||||||
|
else:
|
||||||
|
plant1.try_to_grow()
|
||||||
|
ground.nutrients -= 11
|
||||||
|
ground.water -= 11
|
||||||
|
if ground.pest:
|
||||||
# traktor pozbywa sie szkodnikow
|
# traktor pozbywa sie szkodnikow
|
||||||
|
if plant1.plant_type == self.cypermetryna.plant_type:
|
||||||
|
t = "Tractor used Cypermetryna"
|
||||||
|
elif plant1.plant_type == self.spirotetramat.plant_type:
|
||||||
|
t = "Tractor used Spirotetramat"
|
||||||
|
elif plant1.plant_type == self.spinosad.plant_type:
|
||||||
|
t = "Tractor used Spinosad"
|
||||||
|
print(t)
|
||||||
ground.pest = False
|
ground.pest = False
|
||||||
if ground.weed == True:
|
if ground.weed:
|
||||||
# traktor pozbywa się chwastow
|
# traktor pozbywa się chwastow
|
||||||
|
if plant1.plant_type == self.diflufenikan.plant_type:
|
||||||
|
t = "Tractor used Diflufenikan"
|
||||||
|
elif plant1.plant_type == self.oksadiargyl.plant_type:
|
||||||
|
t = "Tractor used Oksadiargyl"
|
||||||
|
elif plant1.plant_type == self.metazachlor.plant_type:
|
||||||
|
t = "Tractor used Metazachlor"
|
||||||
|
print(t)
|
||||||
ground.weed = False
|
ground.weed = False
|
||||||
if ground.water < plant.water_requirements:
|
if ground.water < plant1.water_requirements:
|
||||||
ground.water += 20
|
ground.water += 20
|
||||||
if ground.nutrients < plant.nutrients_requirements:
|
if ground.nutrients < plant1.nutrients_requirements:
|
||||||
ground.nutrients += 20
|
ground.nutrients += 20
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
class CropProtectionProduct:
|
class CropProtectionProduct:
|
||||||
def __init__(self, strong_against):
|
def __init__(self, strong_against, plant_type):
|
||||||
self.strong_against = strong_against # pestycyd, herbicyd
|
self.strong_against = strong_against # pestycyd, herbicyd
|
||||||
|
self.plant_type = plant_type
|
||||||
|
@ -35,7 +35,7 @@ class Tile:
|
|||||||
|
|
||||||
def randomizeContent(self):
|
def randomizeContent(self):
|
||||||
photo_path = self.randomize_photo()
|
photo_path = self.randomize_photo()
|
||||||
i = random.randint(1, 3) #szansa 1/3
|
i = random.randint(1, 3) # szansa 1/3
|
||||||
if i == 1:
|
if i == 1:
|
||||||
self.image = "resources/images/sampling.png"
|
self.image = "resources/images/sampling.png"
|
||||||
self.photo = photo_path
|
self.photo = photo_path
|
||||||
@ -44,5 +44,4 @@ class Tile:
|
|||||||
self.image = "resources/images/dirt.png"
|
self.image = "resources/images/dirt.png"
|
||||||
self.photo = "resources/images/background.jpg"
|
self.photo = "resources/images/background.jpg"
|
||||||
|
|
||||||
# DISCLAMER check column and choose plant type ("potato","wheat" etc)
|
# DISCLAMER check column and choose plant type ("potato","wheat" etc.)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user