projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Change castle flags. Eightpieces still not OK, but almost
[vchess.git]
/
client
/
src
/
variants
/
Antiking.js
diff --git
a/client/src/variants/Antiking.js
b/client/src/variants/Antiking.js
index
a13247a
..
c3fe013
100644
(file)
--- a/
client/src/variants/Antiking.js
+++ b/
client/src/variants/Antiking.js
@@
-3,10
+3,6
@@
import { ArrayFun } from "@/utils/array";
import { randInt } from "@/utils/alea";
export const VariantRules = class AntikingRules extends ChessRules {
import { randInt } from "@/utils/alea";
export const VariantRules = class AntikingRules extends ChessRules {
- static getPpath(b) {
- return b[1] == "a" ? "Antiking/" + b : b;
- }
-
static get ANTIKING() {
return "a";
}
static get ANTIKING() {
return "a";
}
@@
-15,6
+11,10
@@
export const VariantRules = class AntikingRules extends ChessRules {
return ChessRules.PIECES.concat([V.ANTIKING]);
}
return ChessRules.PIECES.concat([V.ANTIKING]);
}
+ getPpath(b) {
+ return b[1] == "a" ? "Antiking/" + b : b;
+ }
+
setOtherVariables(fen) {
super.setOtherVariables(fen);
this.antikingPos = { w: [-1, -1], b: [-1, -1] };
setOtherVariables(fen) {
super.setOtherVariables(fen);
this.antikingPos = { w: [-1, -1], b: [-1, -1] };
@@
-111,8
+111,8
@@
export const VariantRules = class AntikingRules extends ChessRules {
return res;
}
return res;
}
-
updateVariables
(move) {
- super.
updateVariables
(move);
+
postPlay
(move) {
+ super.
postPlay
(move);
const piece = move.vanish[0].p;
const c = move.vanish[0].c;
// Update antiking position
const piece = move.vanish[0].p;
const c = move.vanish[0].c;
// Update antiking position
@@
-122,8
+122,8
@@
export const VariantRules = class AntikingRules extends ChessRules {
}
}
}
}
-
unupdateVariables
(move) {
- super.
unupdateVariables
(move);
+
postUndo
(move) {
+ super.
postUndo
(move);
const c = move.vanish[0].c;
if (move.vanish[0].p == V.ANTIKING)
this.antikingPos[c] = [move.start.x, move.start.y];
const c = move.vanish[0].c;
if (move.vanish[0].p == V.ANTIKING)
this.antikingPos[c] = [move.start.x, move.start.y];
@@
-131,7
+131,6
@@
export const VariantRules = class AntikingRules extends ChessRules {
getCurrentScore() {
if (this.atLeastOneMove())
getCurrentScore() {
if (this.atLeastOneMove())
- // game not over
return "*";
const color = this.turn;
return "*";
const color = this.turn;
@@
-146,13
+145,27
@@
export const VariantRules = class AntikingRules extends ChessRules {
}
static get VALUES() {
}
static get VALUES() {
- return Object.assign(ChessRules.VALUES, { a: 1000 });
+ return Object.assign(
+ { a: 1000 },
+ ChessRules.VALUES
+ );
}
}
- static GenRandInitFen() {
+ static GenRandInitFen(randomness) {
+ if (randomness == 0)
+ return "rnbqkbnr/pppppppp/3A4/8/8/3a4/PPPPPPPP/RNBQKBNR w 0 ahah -";
+
let pieces = { w: new Array(8), b: new Array(8) };
let pieces = { w: new Array(8), b: new Array(8) };
+ let flags = "";
let antikingPos = { w: -1, b: -1 };
for (let c of ["w", "b"]) {
let antikingPos = { w: -1, b: -1 };
for (let c of ["w", "b"]) {
+ if (c == 'b' && randomness == 1) {
+ pieces['b'] = pieces['w'];
+ antikingPos['b'] = antikingPos['w'];
+ flags += flags;
+ break;
+ }
+
let positions = ArrayFun.range(8);
// Get random squares for bishops, but avoid corners; because,
let positions = ArrayFun.range(8);
// Get random squares for bishops, but avoid corners; because,
@@
-190,6
+203,7
@@
export const VariantRules = class AntikingRules extends ChessRules {
pieces[c][bishop2Pos] = "b";
pieces[c][knight2Pos] = "n";
pieces[c][rook2Pos] = "r";
pieces[c][bishop2Pos] = "b";
pieces[c][knight2Pos] = "n";
pieces[c][rook2Pos] = "r";
+ flags += V.CoordToColumn(rook1Pos) + V.CoordToColumn(rook2Pos);
}
const ranks23_black =
"pppppppp/" +
}
const ranks23_black =
"pppppppp/" +
@@
-209,7
+223,11
@@
export const VariantRules = class AntikingRules extends ChessRules {
ranks23_white +
"/" +
pieces["w"].join("").toUpperCase() +
ranks23_white +
"/" +
pieces["w"].join("").toUpperCase() +
- " w 0
1111
-"
+ " w 0
" + flags + "
-"
);
}
);
}
+
+ static get SEARCH_DEPTH() {
+ return 2;
+ }
};
};