Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.08 KB | None | 0 0
  1.  
  2.     private byte[][] getLigneGagnant(byte joueur) {
  3.         byte[][] ligneGagnante = new byte[2][3];
  4.  
  5.         for (byte i = 0; i < NBR_RANGEE; i++) {
  6.             if (tableauTicTacToeInt[i][0] == joueur && tableauTicTacToeInt[i][1] == joueur
  7.                     && tableauTicTacToeInt[i][2] == joueur) {
  8.                 ligneGagnante[0]=new byte[] {i,i,i};
  9.                 ligneGagnante[1]=new byte[] {0,1,2};
  10.             }
  11.  
  12.         }
  13.         for (byte i = 0; i < NBR_COLONNES; i++) {
  14.             if (tableauTicTacToeInt[0][i] == joueur && tableauTicTacToeInt[1][i] == joueur
  15.                     && tableauTicTacToeInt[2][i] == joueur) {
  16.  
  17.                 ligneGagnante[0]=new byte[] {0,1,2};
  18.                 ligneGagnante[1]=new byte[] {i,i,i};
  19.             }
  20.  
  21.         }
  22.         if (tableauTicTacToeInt[0][0] == joueur && tableauTicTacToeInt[1][1] == joueur
  23.                 && tableauTicTacToeInt[2][2] == joueur) {
  24.  
  25.             ligneGagnante[0]=new byte[] {0,1,2};
  26.             ligneGagnante[1]=new byte[] {0,1,2};
  27.  
  28.         }
  29.         if (tableauTicTacToeInt[2][0] == joueur && tableauTicTacToeInt[1][1] == joueur
  30.                 && tableauTicTacToeInt[0][2] == joueur) {
  31.             ligneGagnante[0]=new byte[] {0,1,2};
  32.             ligneGagnante[1]=new byte[] {2,1,0};
  33.         }
  34.  
  35.         return ligneGagnante;
  36.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement