Sujet résolu
L'auteur a trouvé une solution à son problème.
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()
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()
il y a 3 ans
Sponsorisé
Connectez-vous pour masquer les pubsSi vous voulez changer vos 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)
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)
il y a 3 ans-PEMT
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()
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()
C'est le code de la gameboy pour aller sur la Lune ça
Regardez Welcome to the NHK !!!!
il y a 3 ans
C'est le code de la gameboy pour aller sur la Lune ça
Non c’est beaucoup plus simple:
def aller_sur_la_lune(self):
if self.location == 'Terre':
self.location = 'Lune'
print("Le vaisseau est maintenant sur la Lune.")
def aller_sur_la_lune(self):
if self.location == 'Terre':
self.location = 'Lune'
print("Le vaisseau est maintenant sur la Lune.")
il y a 3 ans
Non c’est beaucoup plus simple:
def aller_sur_la_lune(self):
if self.location == 'Terre':
self.location = 'Lune'
print("Le vaisseau est maintenant sur la Lune.")
def aller_sur_la_lune(self):
if self.location == 'Terre':
self.location = 'Lune'
print("Le vaisseau est maintenant sur la Lune.")
Tout nez que tromperi
Regardez Welcome to the NHK !!!!
il y a 3 ans
if ( npc == monkey){
set.location = South
construction.model = Herb
set.qi = random(1-50)
}
set.location = South
construction.model = Herb
set.qi = random(1-50)
}
il y a 3 ans


















