I have kinda weird problem. I need to make a Tic Tac Toe game for my school project. The board is resizable (e.g. 5x5, 7x7, 12x12) and I want to just check if the first row is filled with circles or crosses, but my code always returns false. I really don't know what I'm doing wrong.
for (i = 0; i < size; i++) {
console.log(pola[i]);
if (pola[i] == winnerK || pola[i] == winnerR) {
console.log("gz");
alert("Win");
}
}
where:
size is just an int describing board size (like 5 or so)
pola is a 2 dimensional array containing cells in board
winnerK is an array, which for 5x5 board is [1, 1, 1, 1, 1]
winnerR is pretty much the same as winnerK, but filled with [2, 2, 2, 2, 2]
So every time user clicks a cell, a field in array "pola" is changed to 1 or 2 (1 for circles, 2 for crosses). And when I console.log it everything looks good, but it won't give me "true" no matter what I'm doing.
Please, help me ;_;