I want to check my rows for x's and o's in a row.
This is what I have
If(gameboard[0] == 1 && gameboard[1] == 1 && gameboard[2] == 1){
return winner;
This works fine for me. What I want to know is how could I reduce the amount of code here rather than having a load of if statements to check each column row especially if I decided to make the grid bigger.
I tried doing the following
for (int i = 0; i<3; i++){
gameboard[i] = 1;
}
return winner;
But this doesn't do anything. Any help is appreciated.
Thanks
Aucun commentaire:
Enregistrer un commentaire