-
-
Save parzibyte/8bb17e4b84e6db48aa9a10da4b592d5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Imprime algo que el CPU "dice" | |
static void hablar(String mensaje, char jugador) { | |
System.out.printf("\nCPU (%c) dice: %s\n\n", jugador, mensaje); | |
} | |
// Debería llamarse después de verificar si alguien gana | |
// Indica si hay un empate | |
static boolean empate(char[][] tableroOriginal) { | |
int y; | |
for (y = 0; y < FILAS; y++) { | |
int x; | |
for (x = 0; x < COLUMNAS; x++) { | |
// Si hay al menos un espacio vacío se dice que no hay empate | |
if (tableroOriginal[y][x] == ESPACIO_VACIO) { | |
return false; | |
} | |
} | |
} | |
return true; | |
} | |
// Devuelve un número aleatorio en un rango, incluyendo los límites | |
public static int aleatorioEnRango(int minimo, int maximo) { | |
// nextInt regresa en rango pero con límite superior exclusivo, por eso sumamos 1 | |
return ThreadLocalRandom.current().nextInt(minimo, maximo + 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment