From 0e3d50092e41e0a66ab6dd003cbf49bc110ef8d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=20Mu=C3=B1oz?= Date: Mon, 11 Nov 2024 11:22:31 +0100 Subject: [PATCH] 11 --- .../bloque07_tresEnRaya/TresEnRaya.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) 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 { - -