TP3A IA1 faite
This commit is contained in:
parent
b8c6e82f92
commit
3770cd4656
|
@ -14,6 +14,8 @@ __author__ = 'BEAUSSART Jean-loup & PREUD\'HOMME Geoffrey'
|
|||
__date_creation__ = 'Mon, 16 Feb 2015 19:30:54 +0100'
|
||||
|
||||
import bataille_navale as BN
|
||||
from random import randint
|
||||
|
||||
|
||||
def jouerIA(nom, descr, niveau):
|
||||
"""
|
||||
|
@ -41,7 +43,7 @@ def jouerIA(nom, descr, niveau):
|
|||
print(nav + " touché.")
|
||||
else:
|
||||
print(nav + " coulé.")
|
||||
sauver_result(nom, descr, nbre_tirs)
|
||||
BN.sauver_result(nom, descr, nbre_tirs)
|
||||
print("Terminé en %d tirs" % nbre_tirs)
|
||||
|
||||
|
||||
|
@ -50,8 +52,11 @@ def choisir_tir(jeu, res, niveau):
|
|||
fonction = niveaux[niveau - 1]
|
||||
return fonction(jeu, res)
|
||||
|
||||
|
||||
def chosir_tir_1(jeu, res):
|
||||
return (1, 1) # IA de malade mental
|
||||
x = randint(0, jeu['plateau']['larg'])
|
||||
y = randint(0, jeu['plateau']['haut'])
|
||||
return (x, y)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Reference in a new issue