Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
themeEclipse
languagejavascript
titleMake a note of which player the human should be...
linenumberstrue
// take a snapshot of which player the human is at the start of the game
var humanPlayer = selectedPlayer;
 
// has human switched players?
function checkForPlayerSwitch() {
  if (selectedPlayer != humanPlayer) { // human has switched players
    console("Naughty, naughty!");
  }
}
setTimer("checkForPlayerSwitch",10000); // check every 10 seconds

See also