Skip to content

Instantly share code, notes, and snippets.

@JeffML
Created May 29, 2017 22:48
Show Gist options
  • Save JeffML/582c8af42afcd27e2132e7d001e84eb8 to your computer and use it in GitHub Desktop.
Save JeffML/582c8af42afcd27e2132e7d001e84eb8 to your computer and use it in GitHub Desktop.
module.exports = function specialMovement(options) {
//...
this.add({
role: "movement",
cmd: "rawMoves",
isPawn: true
}, (msg, reply) => {
if (msg.piece.piece !== 'P') {
return ("piece was not a pawn")
}
var pos = msg.piece.position;
const rawMoves = pawnMoves(pos);
reply(null, rawMoves);
});
this.add({
role: "movement",
cmd: "rawMoves",
isKnight: true
}, (msg, reply) => {
if (msg.piece.piece !== 'N') {
return ("piece was not a knight")
}
var rawMoves = [];
var pos = msg.piece.position;
rawMoves = knightMoves(pos);
reply(null, rawMoves);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment