diff --git a/src/tutorialJava/capitulo4_Arrays/ejercicios/bloque07_tresEnRaya/TresEnRaya.java b/src/tutorialJava/capitulo4_Arrays/ejercicios/bloque07_tresEnRaya/TresEnRaya.java index 0550411..7c2429d 100644 --- a/src/tutorialJava/capitulo4_Arrays/ejercicios/bloque07_tresEnRaya/TresEnRaya.java +++ b/src/tutorialJava/capitulo4_Arrays/ejercicios/bloque07_tresEnRaya/TresEnRaya.java @@ -10,24 +10,19 @@ public class TresEnRaya { * @param args */ public static void main(String[] args) { -// int t[][] = new int[3][3]; - int t[][] = new int[][] {{2, 1, 1}, - {1, 2, 2}, - {2, 2, 0}}; + int t[][] = new int[3][3]; +// int t[][] = new int[][] {{2, 1, 1}, +// {1, 2, 2}, +// {2, 2, 0}}; int turno = 1; - -// inicializaTablero(t); - + inicializaTablero(t); do { // Muestro tablero imprimieTablero(t); - // Pido jugada a jugador (turno) pidoJugadaAJugador(t, turno); - // Cambiar turno turno = cambiaTurno(turno); - } while (ganadorDelJuego(t) == 0 && !hayEmpate(t)); // Imprimo ganador o empate @@ -61,7 +56,14 @@ public class TresEnRaya { */ public static void imprimieTablero(int t[][]) { System.out.println("\nTablero actual: "); - UtilsArrays.imprimeMatriz(t); + + for (int i = 0; i < t.length; i++) { + for (int j = 0; j < t[i].length; j++) { + System.out.print( (t[i][j] != 0)? (t[i][j] == 1)? "X" : "O" : "-"); + System.out.print("\t"); + } + System.out.println(); + } } /** @@ -157,5 +159,3 @@ public class TresEnRaya { - -