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()
|
||||
|
||||
def decision_tree(self):
|
||||
match (self.get_current_tile().type):
|
||||
case ('grass'):
|
||||
action = self.make_decision()
|
||||
if (self.get_current_tile().type != 'grass' or self.get_current_tile().type == 'water'): action = 'nothing'
|
||||
case ('water'):
|
||||
action = 'nothing'
|
||||
case _:
|
||||
action = 'water'
|
||||
self.prev_action = action
|
||||
|
||||
print("Decyzja podjęta przez drzewo decyzyjne: ", action)
|
||||
@ -180,7 +185,7 @@ class Tractor(pygame.sprite.Sprite):
|
||||
case ('water'):
|
||||
self.get_current_tile().water_level += 10
|
||||
case ('plant(bób)'):
|
||||
self.get_current_tile().set_type('marchew')
|
||||
self.get_current_tile().set_type('bób')
|
||||
case ('plant(brokuł)'):
|
||||
self.get_current_tile().set_type('brokuł')
|
||||
case ('plant(brukselka)'):
|
||||
@ -188,11 +193,11 @@ class Tractor(pygame.sprite.Sprite):
|
||||
case ('plant(burak)'):
|
||||
self.get_current_tile().set_type('burak')
|
||||
case ('plant(cebula)'):
|
||||
self.get_current_tile().set_type('marchew')
|
||||
self.get_current_tile().set_type('cebula')
|
||||
case ('plant(cukinia)'):
|
||||
self.get_current_tile().set_type('cukinia')
|
||||
case ('plant(dynia)'):
|
||||
self.get_current_tile().set_type('fasola')
|
||||
self.get_current_tile().set_type('dynia')
|
||||
case ('plant(fasola)'):
|
||||
self.get_current_tile().set_type('fasola')
|
||||
case ('plant(groch)'):
|
||||
@ -212,7 +217,7 @@ class Tractor(pygame.sprite.Sprite):
|
||||
case ('plant(papryka)'):
|
||||
self.get_current_tile().set_type('papryka')
|
||||
case ('plant(pietruszka)'):
|
||||
self.get_current_tile().set_type('marchew')
|
||||
self.get_current_tile().set_type('pietruszka')
|
||||
case ('plant(pomidor)'):
|
||||
self.get_current_tile().set_type('pomidor')
|
||||
case ('plant(por)'):
|
||||
|
Loading…
Reference in New Issue
Block a user