From d363120ef43652daf211e0d016df447a74fc4a8a Mon Sep 17 00:00:00 2001 From: Mateusz Date: Tue, 26 May 2020 21:33:36 +0200 Subject: [PATCH] GA skelethon --- src/AI/GaTravelingForHerbs/GeneticAlgorithm.py | 4 ++++ src/AI/GaTravelingForHerbs/Traveling.py | 10 ++++++++++ src/entities/Interactable.py | 7 ++++--- src/entities/Player.py | 9 ++++++--- 4 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 src/AI/GaTravelingForHerbs/GeneticAlgorithm.py create mode 100644 src/AI/GaTravelingForHerbs/Traveling.py diff --git a/src/AI/GaTravelingForHerbs/GeneticAlgorithm.py b/src/AI/GaTravelingForHerbs/GeneticAlgorithm.py new file mode 100644 index 0000000..77a1416 --- /dev/null +++ b/src/AI/GaTravelingForHerbs/GeneticAlgorithm.py @@ -0,0 +1,4 @@ +from random import random, choice + +class GeneticAlgorithm: + pass \ No newline at end of file diff --git a/src/AI/GaTravelingForHerbs/Traveling.py b/src/AI/GaTravelingForHerbs/Traveling.py new file mode 100644 index 0000000..33332a4 --- /dev/null +++ b/src/AI/GaTravelingForHerbs/Traveling.py @@ -0,0 +1,10 @@ +from random import randint, sample +from math import sqrt + +START_COORD = [(6, 2)] +END_COORD = [(10, 7)] +COORDS = [(12, 2), (16, 2), (17, 5), (14, 7), (17, 17), (13, 17), (5, 15), (2, 9), (8, 5), (11, 10)] + +class Traveling: + def __init__(self, coords): + self.coords = coords \ No newline at end of file diff --git a/src/entities/Interactable.py b/src/entities/Interactable.py index 2edffdb..076bd9c 100644 --- a/src/entities/Interactable.py +++ b/src/entities/Interactable.py @@ -44,11 +44,12 @@ class Interactable(Entity): Player.herbs += 1 print(Player.herbs) - if Player.herbs == 10: + if Player.herbs == 10 and self.classifier == Classifiers.REST: + print("Should reset") Player.statistics.set_hp(100) Player.statistics.set_stamina(100) - Player.statistics.set_thirst(0) - Player.statistics.set_hunger(0) + Player.statistics.set_thirst(-100) + Player.statistics.set_hunger(-100) def __str__(self): return "Entity - ID:{}, pos:({}x, {}y), {}".format(self.id, self.x, self.y, self.classifier.name) diff --git a/src/entities/Player.py b/src/entities/Player.py index cd858c5..bd77870 100644 --- a/src/entities/Player.py +++ b/src/entities/Player.py @@ -54,11 +54,14 @@ class Player(Entity): """ # looses hunger - self.statistics.set_hunger(1.7) + # self.statistics.set_hunger(1.7) + self.statistics.set_hunger(0.7) # gets more thirsty - self.statistics.set_thirst(2.2) + # self.statistics.set_thirst(2.2) + self.statistics.set_thirst(1.2) # gets tired - self.statistics.set_stamina(-1.9) + # self.statistics.set_stamina(-1.9) + self.statistics.set_stamina(-0.9) def applyTimeFatigue(self): """