Skip to content

Instantly share code, notes, and snippets.

@JeffML
Created July 16, 2017 23:18
Show Gist options
  • Save JeffML/54598c92775415e2457a48926d6be761 to your computer and use it in GitHub Desktop.
Save JeffML/54598c92775415e2457a48926d6be761 to your computer and use it in GitHub Desktop.
Second legalMoves service
this.add('role:movement,cmd:legalMoves', function (msg, reply) {
this.prior(msg, function (err, result) {
if (msg.board) {
const result2 = legalMovesWithBoard(msg, result);
if (msg.piece.piece === 'K') {
legalMovesWithKing.call(this, msg, result2, reply)
} else {
reply(err, result2);
}
} else {
reply(err, result);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment