Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private byte[][] getLigneGagnant(byte joueur) {
- byte[][] ligneGagnante = new byte[2][3];
- for (byte i = 0; i < NBR_RANGEE; i++) {
- if (tableauTicTacToeInt[i][0] == joueur && tableauTicTacToeInt[i][1] == joueur
- && tableauTicTacToeInt[i][2] == joueur) {
- ligneGagnante[0]=new byte[] {i,i,i};
- ligneGagnante[1]=new byte[] {0,1,2};
- }
- }
- for (byte i = 0; i < NBR_COLONNES; i++) {
- if (tableauTicTacToeInt[0][i] == joueur && tableauTicTacToeInt[1][i] == joueur
- && tableauTicTacToeInt[2][i] == joueur) {
- ligneGagnante[0]=new byte[] {0,1,2};
- ligneGagnante[1]=new byte[] {i,i,i};
- }
- }
- if (tableauTicTacToeInt[0][0] == joueur && tableauTicTacToeInt[1][1] == joueur
- && tableauTicTacToeInt[2][2] == joueur) {
- ligneGagnante[0]=new byte[] {0,1,2};
- ligneGagnante[1]=new byte[] {0,1,2};
- }
- if (tableauTicTacToeInt[2][0] == joueur && tableauTicTacToeInt[1][1] == joueur
- && tableauTicTacToeInt[0][2] == joueur) {
- ligneGagnante[0]=new byte[] {0,1,2};
- ligneGagnante[1]=new byte[] {2,1,0};
- }
- return ligneGagnante;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement