when player pickup all herbs, his statistics reset
This commit is contained in:
parent
51d50f7cd6
commit
1eb62c3382
BIN
data/images/entities/herb1.png
Normal file
BIN
data/images/entities/herb1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.0 KiB |
BIN
data/images/entities/herb2.png
Normal file
BIN
data/images/entities/herb2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
@ -459,5 +459,35 @@
|
|||||||
"y": 15
|
"y": 15
|
||||||
},
|
},
|
||||||
"isPickupable" : false
|
"isPickupable" : false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "herb1",
|
||||||
|
"position" : {
|
||||||
|
"x": 12,
|
||||||
|
"y": 12
|
||||||
|
},
|
||||||
|
"isPickupable": true,
|
||||||
|
"effect" : {
|
||||||
|
"hp" : 0,
|
||||||
|
"stamina" : 0,
|
||||||
|
"thirst" : 0,
|
||||||
|
"hunger" : 0
|
||||||
|
},
|
||||||
|
"type" : "herb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "herb2",
|
||||||
|
"position" : {
|
||||||
|
"x": 14,
|
||||||
|
"y": 8
|
||||||
|
},
|
||||||
|
"isPickupable": true,
|
||||||
|
"effect" : {
|
||||||
|
"hp" : 0,
|
||||||
|
"stamina" : 0,
|
||||||
|
"thirst" : 0,
|
||||||
|
"hunger" : 0
|
||||||
|
},
|
||||||
|
"type" : "herb"
|
||||||
}
|
}
|
||||||
]
|
]
|
41
src/AI/resultsExplorer/results.txt
Normal file
41
src/AI/resultsExplorer/results.txt
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
GA Results from 2020-05-25 14:52:10.398825
|
||||||
|
Population: 0
|
||||||
|
Best fitness: 71
|
||||||
|
Best offspring: [0.4617656024456773, 0.5990607970781336, 0.44395485033011356, 0.3943162694343978]
|
||||||
|
|
||||||
|
Population: 1
|
||||||
|
Best fitness: 125
|
||||||
|
Best offspring: [0.4241776287024901, 0.7330816824377345, 0.5033842793318899, 0.5250431705157725]
|
||||||
|
|
||||||
|
Population: 2
|
||||||
|
Best fitness: 130
|
||||||
|
Best offspring: [0.5997880055122891, 0.6462721899244326, 0.23090549744347125, 0.6682296855487012]
|
||||||
|
|
||||||
|
Population: 3
|
||||||
|
Best fitness: 130
|
||||||
|
Best offspring: [0.5997880055122891, 0.622805396229243, 0.23361305509908434, 0.6015199688363583]
|
||||||
|
|
||||||
|
Population: 4
|
||||||
|
Best fitness: 130
|
||||||
|
Best offspring: [0.5853943750328781, 0.6680555543169949, 0.31129888112036036, 0.6300813433522894]
|
||||||
|
|
||||||
|
Population: 5
|
||||||
|
Best fitness: 181
|
||||||
|
Best offspring: [0.5745485398305222, 0.6613255347457894, 0.27558572895124217, 0.698772916997859]
|
||||||
|
|
||||||
|
Population: 6
|
||||||
|
Best fitness: 186
|
||||||
|
Best offspring: [0.5709501322106695, 0.6734792710611923, 0.26190097471811163, 0.6632002687383984]
|
||||||
|
|
||||||
|
Population: 7
|
||||||
|
Best fitness: 186
|
||||||
|
Best offspring: [0.5847284354417799, 0.6529132370776863, 0.2597728412225748, 0.6725458259803849]
|
||||||
|
|
||||||
|
Population: 8
|
||||||
|
Best fitness: 186
|
||||||
|
Best offspring: [0.591617587057335, 0.6603693158815798, 0.2612154609367813, 0.6339049209442479]
|
||||||
|
|
||||||
|
Population: 9
|
||||||
|
Best fitness: 186
|
||||||
|
Best offspring: [0.6668927319878386, 0.6640973552835265, 0.2631901140248719, 0.6892719308559486]
|
||||||
|
|
11
src/AI/resultsExplorer/resultsRaw.txt
Normal file
11
src/AI/resultsExplorer/resultsRaw.txt
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
=HEADER=GA=
|
||||||
|
[0.4617656024456773, 0.5990607970781336, 0.44395485033011356, 0.3943162694343978, 71]
|
||||||
|
[0.4241776287024901, 0.7330816824377345, 0.5033842793318899, 0.5250431705157725, 125]
|
||||||
|
[0.5997880055122891, 0.6462721899244326, 0.23090549744347125, 0.6682296855487012, 130]
|
||||||
|
[0.5997880055122891, 0.622805396229243, 0.23361305509908434, 0.6015199688363583, 130]
|
||||||
|
[0.5853943750328781, 0.6680555543169949, 0.31129888112036036, 0.6300813433522894, 130]
|
||||||
|
[0.5745485398305222, 0.6613255347457894, 0.27558572895124217, 0.698772916997859, 181]
|
||||||
|
[0.5709501322106695, 0.6734792710611923, 0.26190097471811163, 0.6632002687383984, 186]
|
||||||
|
[0.5847284354417799, 0.6529132370776863, 0.2597728412225748, 0.6725458259803849, 186]
|
||||||
|
[0.591617587057335, 0.6603693158815798, 0.2612154609367813, 0.6339049209442479, 186]
|
||||||
|
[0.6668927319878386, 0.6640973552835265, 0.2631901140248719, 0.6892719308559486, 186]
|
@ -25,3 +25,4 @@ class Classifiers(Enum):
|
|||||||
FOOD = 0
|
FOOD = 0
|
||||||
WATER = 1
|
WATER = 1
|
||||||
REST = 2
|
REST = 2
|
||||||
|
HERB = 3
|
||||||
|
@ -26,6 +26,8 @@ class Interactable(Entity):
|
|||||||
self.classifier = Classifiers.WATER
|
self.classifier = Classifiers.WATER
|
||||||
elif classifier == "rest":
|
elif classifier == "rest":
|
||||||
self.classifier = Classifiers.REST
|
self.classifier = Classifiers.REST
|
||||||
|
elif classifier == "herb":
|
||||||
|
self.classifier = Classifiers.HERB
|
||||||
|
|
||||||
def on_interaction(self, Player):
|
def on_interaction(self, Player):
|
||||||
"""
|
"""
|
||||||
@ -38,5 +40,15 @@ class Interactable(Entity):
|
|||||||
Player.statistics.set_thirst(self.Statistics.thirst)
|
Player.statistics.set_thirst(self.Statistics.thirst)
|
||||||
Player.statistics.set_hunger(self.Statistics.hunger)
|
Player.statistics.set_hunger(self.Statistics.hunger)
|
||||||
|
|
||||||
|
if self.classifier == Classifiers.HERB:
|
||||||
|
Player.herbs += 1
|
||||||
|
print(Player.herbs)
|
||||||
|
|
||||||
|
if Player.herbs == 2:
|
||||||
|
Player.statistics.set_hp(100)
|
||||||
|
Player.statistics.set_stamina(100)
|
||||||
|
Player.statistics.set_thirst(0)
|
||||||
|
Player.statistics.set_hunger(0)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "Entity - ID:{}, pos:({}x, {}y), {}".format(self.id, self.x, self.y, self.classifier.name)
|
return "Entity - ID:{}, pos:({}x, {}y), {}".format(self.id, self.x, self.y, self.classifier.name)
|
||||||
|
@ -22,6 +22,7 @@ class Player(Entity):
|
|||||||
super().__init__("player.png", size, spawnpoint, False)
|
super().__init__("player.png", size, spawnpoint, False)
|
||||||
|
|
||||||
self.statistics = Statistics(100, 0, 0, 100)
|
self.statistics = Statistics(100, 0, 0, 100)
|
||||||
|
self.herbs = 0
|
||||||
# How many steps has the player taken through its lifetime
|
# How many steps has the player taken through its lifetime
|
||||||
self.movePoints = 0
|
self.movePoints = 0
|
||||||
# Tracks how much time has passed since the player is alive
|
# Tracks how much time has passed since the player is alive
|
||||||
|
Loading…
Reference in New Issue
Block a user