Skip to content

Instantly share code, notes, and snippets.

@parzibyte

parzibyte/ganador.js

Last active Aug 5, 2020
Embed
What would you like to do?
isWinner(player, board) {
for (let y = 0; y < ROWS; y++) {
for (let x = 0; x < COLUMNS; x++) {
let count = 0;
count = this.countUp(x, y, player, board);
if (count >= CONNECT) return true;
count = this.countRight(x, y, player, board);
if (count >= CONNECT) return true;
count = this.countUpRight(x, y, player, board);
if (count >= CONNECT) return true;
count = this.countDownRight(x, y, player, board);
if (count >= CONNECT) return true;
}
}
return false;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment