Commit a50c0e6a61105aa263db67354642c8fee689574f

Authored by Trogno Lucas
1 parent fd4dadb0

programme d'attaque de l'IA

Showing 1 changed file with 13 additions and 4 deletions   Show diff stats
IAattaque.py
1   -
2 1 import numpy as np
3 2 import random as rd
4 3 import builtins
5   -from IA import position
  4 +#from IA import position
6 5  
7 6 def f(c):
8 7 return ord(c)-ord("A")+1
9 8  
10 9 def attaque(M1,position):
  10 + print(position)
  11 + victoire=''
11 12 a=-1
12 13 b=-1
13 14 case=2
... ... @@ -38,7 +39,8 @@ def attaque(M1,position):
38 39 while case==1 :
39 40 print("case attaquee :",a,b,"Touche !")
40 41 M1[a][b]=2
41   - position[(a,b)]=position[(a,b)][0],2
  42 + print(position[(a,b)])
  43 + position[(a,b)]=position[(a,b)][0],position[(a,b)][1],2
42 44 elem=position[(a,b)][0]
43 45 possib=[]
44 46 if a-1>=0 :
... ... @@ -60,4 +62,11 @@ def attaque(M1,position):
60 62 print("case attaquee :",a,b,"Manque !")
61 63 message="jeu non fini"
62 64 L=[M1,message,position]
63   - return L
64 65 \ No newline at end of file
  66 + e=0
  67 + for i in range(10):
  68 + for j in range(10):
  69 + if M1[i][j]==1:
  70 + e=e+1
  71 + if e==0:
  72 + victoire='victoire de IA'
  73 + return victoire,M1,position
65 74 \ No newline at end of file
... ...