diff --git a/.idea/ai-project.iml b/.idea/ai-project.iml index 9339130..a23e703 100644 --- a/.idea/ai-project.iml +++ b/.idea/ai-project.iml @@ -5,7 +5,7 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 3fc3916..dc9ea49 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/src/plant.py b/src/plant.py new file mode 100644 index 0000000..7e12859 --- /dev/null +++ b/src/plant.py @@ -0,0 +1,39 @@ +class Plant: + """class representing plants""" + + def __init__(self, species, tile): + self.species = species + self.tile = tile + self.position = tile.position + match species: + case "potato": + self.min_hydration = 60 + self.max_hydration = 80 + self.plant_protectant = "Altima 500SC" + self.fertilizer = "mocznik.pl" + case "tomato": + self.min_hydration = 70 + self.max_hydration = 80 + self.plant_protectant = "do uzupełnienia" + self.fertilizer = "do uzupełnienia" + case "beetroot": + self.min_hydration = 50 + self.max_hydration = 75 + self.plant_protectant = "do uzupełnienia" + self.fertilizer = "do uzupełnienia" + case "cucumber": + self.min_hydration = 70 + self.max_hydration = 90 + self.plant_protectant = "do uzupełnienia" + self.fertilizer = "do uzupełnienia" + self.growth = 0 # value between 0 and 1 + self.wilted = False + + def remove(self): + self.tile.planted = False + + def grow(self): + return True + # function growing plant during tick + # using parameters of field tile to calculate growth + # for example if tile is hydrated and fertilized it will grow faster \ No newline at end of file diff --git a/src/tractor.py b/src/tractor.py index 521b33f..0f4be36 100644 --- a/src/tractor.py +++ b/src/tractor.py @@ -7,3 +7,22 @@ class Tractor: self.addition = addition self.trajectory = trajectory + def hydrate(self, tile): + if tile.hydration < tile.plant.min_hydration: + tile.hydration = tile.plant.max_hydration + + def collect(self, tile): + if tile.plant.growth >= 0.75: + tile.remove_plant() + + def cut(self, tile): + tile.remove_plant() + + def plant(self, tile): + if not tile.planted: + tile.plant() + + def fertilize(self, tile): + if not tile.isfertilized: + tile.isFertilized = True + tile.fertilizer = tile.plant.fertilizer diff --git a/src/tractor_addons.py b/src/tractor_addons.py new file mode 100644 index 0000000..28043bb --- /dev/null +++ b/src/tractor_addons.py @@ -0,0 +1,8 @@ +class Addon: + """class representing plants""" + + def __init__(self, type, capacity, application): + + self.type = type + self.capacity = capacity + self.application = application \ No newline at end of file