Skip to content

Instantly share code, notes, and snippets.

@nornagon
Created January 8, 2012 08:38
Show Gist options
  • Select an option

  • Save nornagon/1577731 to your computer and use it in GitHub Desktop.

Select an option

Save nornagon/1577731 to your computer and use it in GitHub Desktop.
Sequencing stuff in node.js
function getMoveFromPlayer(player_id, cb) {
process.spawn_child(whatever, cb)
}
function getNextMove() {
if (!gameStillRunning) { return }
getMoveFromPlayer(current_player, function (err, data) {
makeMove(data)
getNextMove()
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment