X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=base_rules.js;h=0f950a240bb4b478d671d02ec9bb0dfe531ff00b;hb=c08a5e745db2b631bedf981d1ba685b312c7e3b5;hp=ae2ca80dfa1405239f46806b8124dcea0e9f7d13;hpb=3ca478329f818efdfe2e03ce72c0effa6a8b0c0b;p=xogo.git diff --git a/base_rules.js b/base_rules.js index ae2ca80..0f950a2 100644 --- a/base_rules.js +++ b/base_rules.js @@ -1686,6 +1686,10 @@ export default class ChessRules { getPotentialMovesOf(piece, [x, y]) { const color = this.getColor(x, y); const stepSpec = this.getStepSpec(color, x, y, piece); + + // TODO: pawns, coregal +console.log(stepSpec); + let squares = []; if (stepSpec.attack) { squares = this.findDestSquares( @@ -1792,7 +1796,10 @@ export default class ChessRules { continue outerLoop; const oldIJ = [i, j]; [i, j] = this.increment([i, j], step); - if (Math.abs(j - oldIJ[1]) > 1 || Math.abs(i - oldIJ[0]) > 1) { + if ( + Math.abs(i - oldIJ[0]) != Math.abs(step[0]) || + Math.abs(j - oldIJ[1]) != Math.abs(step[1]) + ) { // Boundary between segments (cylinder or circular mode) segments.push([[segStart[0], segStart[1]], oldIJ]); segStart = [i, j];