Skip to content

Instantly share code, notes, and snippets.

@deathmarine
Created May 1, 2019 01:50
Show Gist options
  • Save deathmarine/0f6c291540e2ca6773373ba855cecd6c to your computer and use it in GitHub Desktop.
Save deathmarine/0f6c291540e2ca6773373ba855cecd6c to your computer and use it in GitHub Desktop.
Check for win method
public boolean checkForWin(int index) {
//TO DO: check to see if there is a winner. If so, set win field and return true; otherwise, return false
if(gameArray[0] == gameArray[1] && gameArray[1] == gameArray[2])
win = Win.TOP_ROW; // Could probably do this with a case switch
if(gameArray[0] == gameArray[3] && gameArray[3] == gameArray[6])
win = Win.TOP_ROW; // Could probably do this with a case switch
//Blah... If statement
//More If statements
//MOAR if statements
return win != Win.NONE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment