Skip to content

Instantly share code, notes, and snippets.

@ahmaxed
Last active February 4, 2017 10:04
Show Gist options
  • Save ahmaxed/e471a28245565df0dc11ef1df2c75446 to your computer and use it in GitHub Desktop.
Save ahmaxed/e471a28245565df0dc11ef1df2c75446 to your computer and use it in GitHub Desktop.
// checks for the terminal states such as win, lose, and tie
//and returning a value accordingly
if (winning(newBoard, huPlayer)){
return {score:-10};
}
else if (winning(newBoard, aiPlayer)){
return {score:10};
}
else if (availSpots.length === 0){
return {score:0};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment