// Color of thing on square (i,j). '' if square is empty
getColor(i, j) {
if (typeof i == "string")
- return i; //reserves
+ return i; //reserves : 'wb'
return this.board[i][j].charAt(0);
}
// Piece on i,j. '' if square is empty
getPiece(i, j) {
if (typeof j == "string")
- return j; //reserves
+ return j; //reserves : 'bq'
return this.board[i][j].charAt(1);
}
};
}
-// TODO: variable (setupOthers) for lancers directions (x,y) => dir ("0, 1, 2, ...") 0 = top 1 = north east... / white viewpoint
-
-//variable lancer_orient ... --> array size 8 x 8 (TODO?)
- //
-
static get LANCER_STEP() {
return {
'N': [-1, 0],
};
}
+ encodeSquare(x, y) {
+ return (x*this.size.y+y).toString();
+ }
+
pieces(color, x, y) {
let basePieces = super.pieces(color, x, y);
const extension = {
both: [
{
steps: [ V.LANCER_STEP [
- this.lancer_orient[(x*this.size.y+y).toString()] ]
+ this.lancer_orient[this.encodeSquare(x, y)] ]
]
}
]
};
}
+ get pawnPromotions() {
+ // TODO: lancer orientation = backward vertical from promotion square?
+ return ['q', 'r', 'n', 'b', 'j', 's', 'l'];
+ }
+
// lorient : "{z1:NO,z2:SE, ...etc}"
setOtherVariables(fenParsed) {
super.setOtherVariables(fenParsed);
this.lancer_orient = JSON.parse(fenParsed.lorient);
}
- //TODO: from here
-
- static ParseFen(fen) {
- const fenParts = fen.split(" ");
- return Object.assign(
- ChessRules.ParseFen(fen),
- { sentrypush: fenParts[5] }
+ getPartFen(o) {
+ return Object.assign({},
+ super.getPartFen(o),
+ {
+ "lorient": o.init ? "TODO" : this.getLorientFen(),
+ "sentrypush": o.init ? "-" : this.getSentrypushFen()
+ }
);
}
- getFen() {
- return super.getFen() + " " + this.getSentrypushFen();
+ getLorientFen() {
+ // TODO: use this.lancer_orient to output {z1:NO,z2:SE, ...etc}
+ return "";
}
- getFenForRepeat() {
- return super.getFenForRepeat() + "_" + this.getSentrypushFen();
- }
+
+ // TODO: from here --> L1500 in base -- moves generation
getSentrypushFen() {
const L = this.sentryPush.length;
if (!this.sentryPush[L-1]) return "-";
.join("");
}
+
+
setOtherVariables(fen) {
super.setOtherVariables(fen);
// subTurn == 2 only when a sentry moved, and is about to push something
return super.canTake([x1, y1], [x2, y2]);
}
+
+
+
+
+
+
// Is piece on square (x,y) immobilized?
isImmobilized([x, y]) {
const color = this.getColor(x, y);