Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created February 2, 2021 05:17
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/9c653421d240e139c5c255f1d4419657 to your computer and use it in GitHub Desktop.
Save parzibyte/9c653421d240e139c5c255f1d4419657 to your computer and use it in GitHub Desktop.
static int ganador(string jugador, string[,] tablero)
{
/*
* Solo necesitamos
* Arriba
* Derecha
* Arriba derecha
* Abajo derecha
*
* */
int y;
for (y = 0; y < FILAS; y++)
{
int x;
for (x = 0; x < COLUMNAS; x++)
{
int conteoArriba = contarArriba(x, y, jugador, tablero);
if (conteoArriba >= CONECTA)
{
return CONECTA_ARRIBA;
}
if (contarDerecha(x, y, jugador, tablero) >= CONECTA)
{
return CONECTA_DERECHA;
}
if (contarArribaDerecha(x, y, jugador, tablero) >= CONECTA)
{
return CONECTA_ARRIBA_DERECHA;
}
if (contarAbajoDerecha(x, y, jugador, tablero) >= CONECTA)
{
return CONECTA_ABAJO_DERECHA;
}
}
}
return NO_CONECTA;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment