Authored by Trogno Lucas
1 parent 3314e433

### grille de l'IA

Showing 1 changed file with 8 additions and 10 deletions
IAgrille.py

 ... ... @@ -2,15 +2,13 @@ 2 2 import numpy as np 3 3 import random as rd 4 4 import builtins 5 -M2=np.zeros([10,10]) 6 -M1=np.zeros([10,10]) 5 +from IAattaque import f 7 6 8 -def f(c): 9 - return ord(c)-ord("A")+1 10 - 11 -position={} 7 +print('ça marche') 12 8 #constituer sa grille 13 -def grille_IA(bateaux): 9 +def grilleIA(bateaux) : 10 + position={} 11 + M2=np.zeros([10,10]) 14 12 for elem in bateaux: 15 13 k=rd.randint(0,9) 16 14 l=rd.randint(0,9) ... ... @@ -57,9 +55,9 @@ def grille_IA(bateaux): 57 55 if k==m: 58 56 for i in range(min(l,n),max(l,n)+1): 59 57 M2[k][i]=1 60 - position[(k,i)]=elem,max(l,n)-min(l,n)+1,1 58 + position[(k,i)]=elem.nom,max(l,n)-min(l,n)+1,1 61 59 if l==n: 62 60 for i in range(min(k,m),max(k,m)+1): 63 61 M2[i][l]=1 64 - position[(i,l)]=elem,max(k,m)-min(k,m)+1,1 65 - return M2,position 66 62 \ No newline at end of file 63 + position[(i,l)]=elem.nom,max(k,m)-min(k,m)+1,1 64 + return M2,position 67 65 \ No newline at end of file ... ...