From 1f99669d2946b755bc2609235c0124425d5955bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Czeka=C5=84ski?= Date: Sat, 23 May 2020 21:42:10 +0200 Subject: [PATCH] Add classes which will represent environment and will be usable in decision trees Classes to represent player statistics, food objects etc... --- .../projectSpecificClasses/DTEntities/DTFood.py | 9 +++++++++ .../projectSpecificClasses/DTEntities/DTRestPlace.py | 9 +++++++++ .../DTEntities/DTSurvivalEntity.py | 8 ++++++++ .../projectSpecificClasses/DTEntities/DTWater.py | 9 +++++++++ .../projectSpecificClasses/DTPlayerStats.py | 12 ++++++++++++ 5 files changed, 47 insertions(+) create mode 100644 src/AI/DecisionTrees/projectSpecificClasses/DTEntities/DTFood.py create mode 100644 src/AI/DecisionTrees/projectSpecificClasses/DTEntities/DTRestPlace.py create mode 100644 src/AI/DecisionTrees/projectSpecificClasses/DTEntities/DTSurvivalEntity.py create mode 100644 src/AI/DecisionTrees/projectSpecificClasses/DTEntities/DTWater.py create mode 100644 src/AI/DecisionTrees/projectSpecificClasses/DTPlayerStats.py diff --git a/src/AI/DecisionTrees/projectSpecificClasses/DTEntities/DTFood.py b/src/AI/DecisionTrees/projectSpecificClasses/DTEntities/DTFood.py new file mode 100644 index 0000000..3619f20 --- /dev/null +++ b/src/AI/DecisionTrees/projectSpecificClasses/DTEntities/DTFood.py @@ -0,0 +1,9 @@ +from src.AI.DecisionTrees.projectSpecificClasses.DTEntities.DTSurvivalEntity import DTSurvivalEntity +from src.AI.DecisionTrees.projectSpecificClasses.DistFromObject import DistFromObject +from src.AI.DecisionTrees.projectSpecificClasses.SurvivalClassification import SurvivalClassification + + +class DTFood(DTSurvivalEntity): + def __init__(self, distanceFromPlayer: DistFromObject): + super().__init__(distanceFromPlayer) + self.classification = SurvivalClassification.FOOD diff --git a/src/AI/DecisionTrees/projectSpecificClasses/DTEntities/DTRestPlace.py b/src/AI/DecisionTrees/projectSpecificClasses/DTEntities/DTRestPlace.py new file mode 100644 index 0000000..bb2543a --- /dev/null +++ b/src/AI/DecisionTrees/projectSpecificClasses/DTEntities/DTRestPlace.py @@ -0,0 +1,9 @@ +from src.AI.DecisionTrees.projectSpecificClasses.DTEntities.DTSurvivalEntity import DTSurvivalEntity +from src.AI.DecisionTrees.projectSpecificClasses.DistFromObject import DistFromObject +from src.AI.DecisionTrees.projectSpecificClasses.SurvivalClassification import SurvivalClassification + + +class DTRestPlace(DTSurvivalEntity): + def __init__(self, distanceFromPlayer: DistFromObject): + super().__init__(distanceFromPlayer) + self.classification = SurvivalClassification.REST diff --git a/src/AI/DecisionTrees/projectSpecificClasses/DTEntities/DTSurvivalEntity.py b/src/AI/DecisionTrees/projectSpecificClasses/DTEntities/DTSurvivalEntity.py new file mode 100644 index 0000000..b8fbab8 --- /dev/null +++ b/src/AI/DecisionTrees/projectSpecificClasses/DTEntities/DTSurvivalEntity.py @@ -0,0 +1,8 @@ +from src.AI.DecisionTrees.projectSpecificClasses.DistFromObject import DistFromObject + + +class DTSurvivalEntity: + DistFromObjectFromPlayer: DistFromObject + + def __init__(self, distanceFromPlayer: DistFromObject): + self.distanceFromPlayer = distanceFromPlayer diff --git a/src/AI/DecisionTrees/projectSpecificClasses/DTEntities/DTWater.py b/src/AI/DecisionTrees/projectSpecificClasses/DTEntities/DTWater.py new file mode 100644 index 0000000..4aaf1b3 --- /dev/null +++ b/src/AI/DecisionTrees/projectSpecificClasses/DTEntities/DTWater.py @@ -0,0 +1,9 @@ +from src.AI.DecisionTrees.projectSpecificClasses.DTEntities.DTSurvivalEntity import DTSurvivalEntity +from src.AI.DecisionTrees.projectSpecificClasses.DistFromObject import DistFromObject +from src.AI.DecisionTrees.projectSpecificClasses.SurvivalClassification import SurvivalClassification + + +class DTWater(DTSurvivalEntity): + def __init__(self, distanceFromPlayer: DistFromObject): + super().__init__(distanceFromPlayer) + self.classification = SurvivalClassification.WATER diff --git a/src/AI/DecisionTrees/projectSpecificClasses/DTPlayerStats.py b/src/AI/DecisionTrees/projectSpecificClasses/DTPlayerStats.py new file mode 100644 index 0000000..e596bcb --- /dev/null +++ b/src/AI/DecisionTrees/projectSpecificClasses/DTPlayerStats.py @@ -0,0 +1,12 @@ +from src.AI.DecisionTrees.projectSpecificClasses.PlayerStatsValue import PlayerStatsValue + + +class DTPlayerStats: + hungerAmount: PlayerStatsValue + thirstAmount: PlayerStatsValue + staminaAmount: PlayerStatsValue + + def __init__(self, hungerAmount: PlayerStatsValue, thirstAmount: PlayerStatsValue, staminaAmount: PlayerStatsValue): + self.staminaAmount = staminaAmount + self.thirstAmount = thirstAmount + self.hungerAmount = hungerAmount