TP3A choisir_tir_3 préparé
Agit comme choisir_tir_2 pour le moment Nbre de tir bizarrement > 100
This commit is contained in:
parent
6dacab5b62
commit
7114d9bf44
|
@ -65,9 +65,36 @@ def choisir_tir_2(jeu, res):
|
||||||
return (x, y)
|
return (x, y)
|
||||||
|
|
||||||
def choisir_tir_3(jeu, res):
|
def choisir_tir_3(jeu, res):
|
||||||
|
# Définition du mode
|
||||||
|
if 'ia' not in jeu:
|
||||||
|
jeu['ia'] = dict()
|
||||||
|
jeu['ia']['mode'] = 0
|
||||||
|
print(type(res), res)
|
||||||
|
if type(res) == int:
|
||||||
|
if res == BN.COULE:
|
||||||
|
jeu['ia']['mode'] = 0
|
||||||
|
elif res == BN.TOUCHE:
|
||||||
|
print('Again')
|
||||||
|
jeu['ia']['mode'] = 1
|
||||||
|
|
||||||
|
# Acteur
|
||||||
|
if jeu['ia']['mode'] == 1: # Si en mode recherche
|
||||||
|
print('DEBUG MODE RECHERCHE')
|
||||||
|
while 1:
|
||||||
x = randint(0, jeu['plateau']['larg'])
|
x = randint(0, jeu['plateau']['larg'])
|
||||||
y = randint(0, jeu['plateau']['haut'])
|
y = randint(0, jeu['plateau']['larg'])
|
||||||
return (x, y)
|
coup = (x, y)
|
||||||
|
if coup not in jeu['coups_joues']:
|
||||||
|
break
|
||||||
|
else: # Si en mode aléatoire
|
||||||
|
while 1:
|
||||||
|
x = randint(0, jeu['plateau']['larg'])
|
||||||
|
y = randint(0, jeu['plateau']['larg'])
|
||||||
|
coup = (x, y)
|
||||||
|
if coup not in jeu['coups_joues']:
|
||||||
|
break
|
||||||
|
d_coup = coup
|
||||||
|
return coup
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -75,4 +102,4 @@ if __name__ == '__main__':
|
||||||
if len(sys.argv) != 4:
|
if len(sys.argv) != 4:
|
||||||
jouerIA('Pirate borgne', '1', 1)
|
jouerIA('Pirate borgne', '1', 1)
|
||||||
else:
|
else:
|
||||||
jouerIA(sys.argv[1], sys.argv[2], sys.argv[3])
|
jouerIA(sys.argv[1], sys.argv[2], int(sys.argv[3]))
|
||||||
|
|
Reference in a new issue