'Defini le tableau des pions pris Public Sub ConfigPionPris(ByVal c As Integer, ByVal l As Integer, ByVal Jcourant As Byte) Dim Tmpc As Integer Dim Tmpl As Integer Dim t As Integer Dim t1 As Integer Dim nbpion As Integer Dim Jadv As Byte For Tmpc = 0 To 9 For Tmpl = 0 To 9 TabPionPris(Tmpc, Tmpl) = CarBlanc Next Tmpl Next Tmpc If Jcourant = CarO Then Jadv = CarX Else Jadv = CarO End If For t = 1 To 8 Tmpc = c + TabDX(t) Tmpl = l + TabDY(t) nbpion = 0 While BoardInput(Tmpc, Tmpl) = Jadv Tmpc = Tmpc + TabDX(t) Tmpl = Tmpl + TabDY(t) nbpion = nbpion + 1 Wend If nbpion › 0 And BoardInput(Tmpc, Tmpl) = Jcourant Then Tmpc = c + TabDX(t) Tmpl = l + TabDY(t) For t1 = 1 To nbpion TabPionPris(Tmpc, Tmpl) = Jcourant Tmpc = Tmpc + TabDX(t) Tmpl = Tmpl + TabDY(t) Next t1 End If Next t End Sub | // Defini le tableau des pions pris public void ConfigPionPris(int c, int l, char Jcourant) { int Tmpc; int Tmpl; int cpt; int cpt1; int nbpion; char Jadv; for(Tmpc = 0; Tmpc ‹= 9; Tmpc++) { for(Tmpl = 0; Tmpl ‹= 9; Tmpl++) { TabPionPris[Tmpc][Tmpl] = CarBlanc; } } if (Jcourant == CarO) { Jadv = CarX; } else { Jadv = CarO; } for(cpt = 1; cpt ‹= 8; cpt++) { Tmpc = c + TabDX[cpt]; Tmpl = l + TabDY[cpt]; nbpion = 0; while (BoardInput(Tmpc,Tmpl) == Jadv) { Tmpc = Tmpc + TabDX[cpt]; Tmpl = Tmpl + TabDY[cpt]; nbpion++; } if ((nbpion › 0) && (BoardInput(Tmpc,Tmpl) == Jcourant)) { Tmpc = c + TabDX[cpt]; Tmpl = l + TabDY[cpt]; for(cpt1 = 1; cpt1 ‹= nbpion; cpt1++) { TabPionPris[Tmpc][Tmpl] = Jcourant; Tmpc = Tmpc + TabDX[cpt]; Tmpl = Tmpl + TabDY[cpt]; } } } } |