Ad
  • Custom User Avatar

    Your switch is wrong.
    The switch should using like this:

    //if you switch for win:
    switch(win){
      case true:
      ...
      case false:
      ...
    }
    //or you switch for lastPlayer:
    switch(lastPlayer){
      case "black":
      ...
      case "white":
      ...
    }