X-Git-Url: https://git.auder.net/img/rock_paper_scissors_lizard_spock.gif?a=blobdiff_plain;f=client%2Fsrc%2Fvariants%2FBall.js;h=3903e2b45dde82d828adb12e2bb384b356ea4d0a;hb=93ce6119a67b8510762dd68a07936b6f22f2ad67;hp=19b81eded4c30dfdd501603ec2cf2a3c70997781;hpb=616561273f216debfeab7f5fc532d0b0a8bc8e2d;p=vchess.git diff --git a/client/src/variants/Ball.js b/client/src/variants/Ball.js index 19b81ede..3903e2b4 100644 --- a/client/src/variants/Ball.js +++ b/client/src/variants/Ball.js @@ -134,17 +134,26 @@ export class BallRules extends ChessRules { break; } - // Get random squares for every piece, totally freely + // Get random squares for every piece, with bishops and phoenixes + // on different colors: let positions = shuffle(ArrayFun.range(9)); - const composition = ['b', 'b', 'r', 'r', 'n', 'n', 'h', 'h', 'q']; - const rem2 = positions[0] % 2; + const composition = ['b', 'b', 'h', 'h', 'n', 'n', 'r', 'r', 'q']; + let rem2 = positions[0] % 2; if (rem2 == positions[1] % 2) { // Fix bishops (on different colors) - for (let i=2; i<9; i++) { + for (let i=4; i<9; i++) { if (positions[i] % 2 != rem2) [positions[1], positions[i]] = [positions[i], positions[1]]; } } + rem2 = positions[2] % 2; + if (rem2 == positions[3] % 2) { + // Fix phoenixes too: + for (let i=4; i<9; i++) { + if (positions[i] % 2 != rem2) + [positions[3], positions[i]] = [positions[i], positions[3]]; + } + } for (let i = 0; i < 9; i++) pieces[c][positions[i]] = composition[i]; } return ( @@ -259,7 +268,7 @@ export class BallRules extends ChessRules { return super.getPotentialMovesFrom([x, y]); } - // "Sliders": at most 2 steps + // "Sliders": at most 3 steps getSlideNJumpMoves([x, y], steps, oneStep) { let moves = []; outerLoop: for (let step of steps) { @@ -268,7 +277,7 @@ export class BallRules extends ChessRules { let stepCount = 1; while (V.OnBoard(i, j) && this.board[i][j] == V.EMPTY) { moves.push(this.getBasicMove([x, y], [i, j])); - if (oneStep || stepCount == 2) continue outerLoop; + if (oneStep || stepCount == 3) continue outerLoop; i += step[0]; j += step[1]; stepCount++;