Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created May 21, 2021 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/88a93fce69196394d51b5919cedae2ff to your computer and use it in GitHub Desktop.
Save parzibyte/88a93fce69196394d51b5919cedae2ff to your computer and use it in GitHub Desktop.
// Indica si el jugador gana
static boolean comprobarSiGana(char jugador, char[][] tablero) {
int y;
for (y = 0; y < FILAS; y++) {
int x;
for (x = 0; x < COLUMNAS; x++) {
if (
contarHaciaArriba(x, y, jugador, tablero) >= CONTEO_PARA_GANAR ||
contarHaciaDerecha(x, y, jugador, tablero) >= CONTEO_PARA_GANAR ||
contarHaciaArribaDerecha(x, y, jugador, tablero) >= CONTEO_PARA_GANAR ||
contarHaciaAbajoDerecha(x, y, jugador, tablero) >= CONTEO_PARA_GANAR) {
return true;
}
}
}
// Terminamos de recorrer y no conectó
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment