Created
May 29, 2017 22:48
-
-
Save JeffML/582c8af42afcd27e2132e7d001e84eb8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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