fix: apply decision tree for choosing new crops
This commit is contained in:
parent
f0970e414b
commit
790438a9a2
@ -165,8 +165,13 @@ class Tractor(pygame.sprite.Sprite):
|
|||||||
self.move()
|
self.move()
|
||||||
|
|
||||||
def decision_tree(self):
|
def decision_tree(self):
|
||||||
action = self.make_decision()
|
match (self.get_current_tile().type):
|
||||||
if (self.get_current_tile().type != 'grass' or self.get_current_tile().type == 'water'): action = 'nothing'
|
case ('grass'):
|
||||||
|
action = self.make_decision()
|
||||||
|
case ('water'):
|
||||||
|
action = 'nothing'
|
||||||
|
case _:
|
||||||
|
action = 'water'
|
||||||
self.prev_action = action
|
self.prev_action = action
|
||||||
|
|
||||||
print("Decyzja podjęta przez drzewo decyzyjne: ", action)
|
print("Decyzja podjęta przez drzewo decyzyjne: ", action)
|
||||||
@ -180,7 +185,7 @@ class Tractor(pygame.sprite.Sprite):
|
|||||||
case ('water'):
|
case ('water'):
|
||||||
self.get_current_tile().water_level += 10
|
self.get_current_tile().water_level += 10
|
||||||
case ('plant(bób)'):
|
case ('plant(bób)'):
|
||||||
self.get_current_tile().set_type('marchew')
|
self.get_current_tile().set_type('bób')
|
||||||
case ('plant(brokuł)'):
|
case ('plant(brokuł)'):
|
||||||
self.get_current_tile().set_type('brokuł')
|
self.get_current_tile().set_type('brokuł')
|
||||||
case ('plant(brukselka)'):
|
case ('plant(brukselka)'):
|
||||||
@ -188,11 +193,11 @@ class Tractor(pygame.sprite.Sprite):
|
|||||||
case ('plant(burak)'):
|
case ('plant(burak)'):
|
||||||
self.get_current_tile().set_type('burak')
|
self.get_current_tile().set_type('burak')
|
||||||
case ('plant(cebula)'):
|
case ('plant(cebula)'):
|
||||||
self.get_current_tile().set_type('marchew')
|
self.get_current_tile().set_type('cebula')
|
||||||
case ('plant(cukinia)'):
|
case ('plant(cukinia)'):
|
||||||
self.get_current_tile().set_type('cukinia')
|
self.get_current_tile().set_type('cukinia')
|
||||||
case ('plant(dynia)'):
|
case ('plant(dynia)'):
|
||||||
self.get_current_tile().set_type('fasola')
|
self.get_current_tile().set_type('dynia')
|
||||||
case ('plant(fasola)'):
|
case ('plant(fasola)'):
|
||||||
self.get_current_tile().set_type('fasola')
|
self.get_current_tile().set_type('fasola')
|
||||||
case ('plant(groch)'):
|
case ('plant(groch)'):
|
||||||
@ -212,7 +217,7 @@ class Tractor(pygame.sprite.Sprite):
|
|||||||
case ('plant(papryka)'):
|
case ('plant(papryka)'):
|
||||||
self.get_current_tile().set_type('papryka')
|
self.get_current_tile().set_type('papryka')
|
||||||
case ('plant(pietruszka)'):
|
case ('plant(pietruszka)'):
|
||||||
self.get_current_tile().set_type('marchew')
|
self.get_current_tile().set_type('pietruszka')
|
||||||
case ('plant(pomidor)'):
|
case ('plant(pomidor)'):
|
||||||
self.get_current_tile().set_type('pomidor')
|
self.get_current_tile().set_type('pomidor')
|
||||||
case ('plant(por)'):
|
case ('plant(por)'):
|
||||||
|
Loading…
Reference in New Issue
Block a user