Oceanus
2023-10-02 23:34:34
import random
import numpy as np
from keras.models import Sequential
from keras.layers import Dense
technologies = {
'Préhistoire': 'Outil en pierre',
'Antiquité': 'Roue',
}
defis = {
'Préhistoire': 'Survie',
'Antiquité': 'Construction',
}
map_size = 100
pop_size = 1000
resource_names = ['food', 'water']
economy = {name: [[0]*map_size for _ in range(map_size)] for name in resource_names}
population = [['']*map_size for _ in range(map_size)]
npc_population = []
class NPC:
def __init__(self, name, age, location):
self.name = name
self.age = age
self.location = location
self.inventory = {name: 0 for name in resource_names}
def act(self):
pass
def die(self):
pass
class Golem:
def __init__(self, location):
self.location = location
def generate_golems():
return [Golem((random.randint(0, map_size - 1), random.randint(0, map_size - 1))) for _ in range(random.randint(1, 10))]
def simuler_comportements_humains():
modele = Sequential([
Dense(64, activation='relu', input_dim=10),
Dense(64, activation='relu'),
Dense(1, activation='sigmoid')
])
modele.compile(optimizer='rmsprop', loss='binary_crossentropy', metrics=['accuracy'])
donnees_entree = np.random.rand(1000, 10)
donnees_sortie = np.random.randint(2, size=(1000, 1))
modele.fit(donnees_entree, donnees_sortie, epochs=10, batch_size=32)
def main():
for i in range(pop_size):
npc_population.append(NPC("NPC {}".format(i), random.randint(16, 80), (random.randint(0, map_size - 1), random.randint(0, map_size - 1))))
golems = generate_golems()
simuler_comportements_humains()
if __name__ == "__main__":
main()
Oceanus
2023-10-02 23:38:01
Le 02 octobre 2023 à 23:36:14 :
Cool, et le cheatcode?
Voilà pour changer tes caractéristiques de golem
golem = Golem(location=(0,0))
print(golem.strength, golem.agility, golem.intelligence)
golem.modify_characteristics(strength=20, agility=5)
print(golem.strength, golem.agility, golem.intelligence)