-
-
-
-
-
- getPotentialN_rookMoves(sq) {
- const c = this.turn;
- const rookSteps = [ [0, -1], [0, 1], [c == 'w' ? -1 : 1, 0] ];
- const backward = (c == 'w' ? 1 : -1);
- const kingSteps = [ [backward, -1], [backward, 0], [backward, 1] ];
- return (
- this.getSlideNJumpMoves(sq, rookSteps).concat(
- this.getSlideNJumpMoves(sq, kingSteps, 1))
- );
- }
-
- getPotentialN_knightMoves(sq) {
- return (
- this.getSlideNJumpMoves(sq, V.steps.$n, 1).concat(
- this.getSlideNJumpMoves(sq, V.steps.f, 1))
- );
- }
-
- getPotentialN_bishopMoves(sq) {
- const backward = (this.turn == 'w' ? 1 : -1);
- const kingSteps = [
- [0, -1], [0, 1], [backward, -1], [backward, 0], [backward, 1]
- ];
- const forward = -backward;
- const knightSteps = [
- [2*forward, -1], [2*forward, 1], [forward, -2], [forward, 2]
- ];
- return (
- this.getSlideNJumpMoves(sq, knightSteps, 1).concat(
- this.getSlideNJumpMoves(sq, kingSteps, 1))
- );
- }
-
- getPotentialN_queenMoves(sq) {
- const backward = (this.turn == 'w' ? 1 : -1);
- const forward = -backward;
- const kingSteps = [
- [forward, -1], [forward, 1],
- [backward, -1], [backward, 0], [backward, 1]
- ];
- const knightSteps = [
- [2*forward, -1], [2*forward, 1], [forward, -2], [forward, 2]
- ];
- const rookSteps = [ [0, -1], [0, 1], [forward, 0] ];
- return (
- this.getSlideNJumpMoves(sq, rookSteps).concat(
- this.getSlideNJumpMoves(sq, kingSteps, 1)).concat(
- this.getSlideNJumpMoves(sq, knightSteps, 1))
- );
- }
-
- getPotentialR_rookMoves(sq) {
- return this.getSlideNJumpMoves(sq, V.steps.r, 4);