Skip to content
Snippets Groups Projects
Commit 8377596f authored by Nick's avatar Nick
Browse files

Merge remote-tracking branch 'origin/dev' into dev

parents 41aa3a36 83c850be
No related branches found
No related tags found
1 merge request!1Verision 1.0 finished
......@@ -49,18 +49,19 @@ public class Board{
public boolean checkForWin(){
//checks rows and columns
for(int i = 0; i < 3; i++) {
if(gameboard[i][0] == gameboard[i][1] && gameboard[i][0] == gameboard[i][2]) {
if((gameboard[i][0] == gameboard[i][1]) && (gameboard[i][0] != '#') && (gameboard[i][0] == gameboard[i][2]) ) {
this.setWinner(gameboard[i][0]);
return true;
}
if(gameboard[0][i] == gameboard[1][i] && gameboard[0][i] == gameboard[2][i]) {
if((gameboard[0][i] == gameboard[1][i]) && (gameboard[i][0] != '#') && (gameboard[0][i] == gameboard[2][i]) ) {
this.setWinner(gameboard[i][0]);
return true;
}
}
}
//checks diagonals
if((gameboard[0][0] == gameboard[1][1] && gameboard[0][0] == gameboard[2][2]) || (gameboard[0][2] == gameboard[1][1] && gameboard[0][2] == gameboard[2][0])) {
//second try to get the fix pushed
if((gameboard[0][0] == gameboard[1][1] && gameboard[0][0] == gameboard[2][2]) || (gameboard[0][2] == gameboard[1][1] && gameboard[1][1] != '#') && gameboard[0][2] == gameboard[2][0] ) {
this.setWinner(gameboard[1][1]);
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment