projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Better Schess notation when introducing pieces while castling
[vchess.git]
/
client
/
src
/
variants
/
Monochrome.js
diff --git
a/client/src/variants/Monochrome.js
b/client/src/variants/Monochrome.js
index
8c74961
..
22242ed
100644
(file)
--- a/
client/src/variants/Monochrome.js
+++ b/
client/src/variants/Monochrome.js
@@
-1,6
+1,7
@@
import { ChessRules } from "@/base_rules";
export class MonochromeRules extends ChessRules {
import { ChessRules } from "@/base_rules";
export class MonochromeRules extends ChessRules {
+
static get HasEnpassant() {
// Pawns would be on the same side
return false;
static get HasEnpassant() {
// Pawns would be on the same side
return false;
@@
-37,6
+38,10
@@
export class MonochromeRules extends ChessRules {
return true;
}
return true;
}
+ getPpath(b) {
+ return (b[1] == V.KNIGHT ? "Enpassant/" : "") + b;
+ }
+
canIplay(side, [x, y]) {
const xBounds = side == 'w' ? [4,7] : [0,3];
return this.turn == side && x >= xBounds[0] && x <= xBounds[1];
canIplay(side, [x, y]) {
const xBounds = side == 'w' ? [4,7] : [0,3];
return this.turn == side && x >= xBounds[0] && x <= xBounds[1];
@@
-60,8
+65,8
@@
export class MonochromeRules extends ChessRules {
getPotentialKingMoves(sq) {
// King become queen:
return (
getPotentialKingMoves(sq) {
// King become queen:
return (
- this.getSlideNJumpMoves(sq, V.steps[V.ROOK].concat(V.steps[V.BISHOP]))
;
- )
+ this.getSlideNJumpMoves(sq, V.steps[V.ROOK].concat(V.steps[V.BISHOP]))
+ )
;
}
getAllPotentialMoves() {
}
getAllPotentialMoves() {
@@
-153,12
+158,18
@@
export class MonochromeRules extends ChessRules {
static GenRandInitFen(randomness) {
// Remove the en-passant + castle part of the FEN
static GenRandInitFen(randomness) {
// Remove the en-passant + castle part of the FEN
- const fen = ChessRules.GenRandInitFen(randomness).slice(0, -6);
+ let fen = ChessRules.GenRandInitFen(randomness).slice(0, -6);
+ // Replace kings with queens
+ fen = fen.replace("k", "q").replace("K", "Q");
+ // Move pawns up:
+ fen = fen.replace("pppppppp/8","8/pppppppp")
+ .replace("8/PPPPPPPP","PPPPPPPP/8");
const firstSpace = fen.indexOf(' ');
const firstSpace = fen.indexOf(' ');
- return (
+ // Paint it black:
+ fen =
fen.substr(0, firstSpace).replace(/[A-Z]/g, (c) => c.toLowerCase()) +
fen.substr(0, firstSpace).replace(/[A-Z]/g, (c) => c.toLowerCase()) +
- fen.substr(firstSpace)
-
)
;
+ fen.substr(firstSpace)
;
+
return fen
;
}
static get SEARCH_DEPTH() {
}
static get SEARCH_DEPTH() {
@@
-207,4
+218,5
@@
export class MonochromeRules extends ChessRules {
}
return notation;
}
}
return notation;
}
+
};
};