1 import ChessRules
from "/base_rules.js";
3 export default class DobutsuRules
extends ChessRules
{
18 const pawnShift
= this.getPawnShift(color
|| 'w');
19 // NOTE: classs change according to playerColor (orientation)
20 const mySide
= (this.playerColor
== color
);
23 "class": (mySide
? "" : "rev-") + "chick",
24 both: [{steps: [[pawnShift
, 0]], range: 1}]
27 "class": (mySide
? "" : "rev-") + "hen",
31 [pawnShift
, 1], [pawnShift
, -1],
32 [0, 1], [0, -1], [1, 0], [-1, 0]
39 "class": (mySide
? "" : "rev-") + "elephant",
40 both: [{steps: [[-1, 1], [-1, -1], [1, 1], [1, -1]], range: 1}]
43 "class": (mySide
? "" : "rev-") + "giraffe",
44 both: [{steps: [[0, 1], [0, -1], [1, 0], [-1, 0]], range: 1}]
47 "class": (mySide
? "" : "rev-") + "lion",
49 steps: [[-1, 1], [-1, -1], [1, 1], [1, -1],
50 [0, 1], [0, -1], [1, 0], [-1, 0]],
59 p
= this.getPiece(x
, y
);
63 static get ReserveArray() {
64 return ['p', 'h', 'e', 'g'];
68 o
.options
= {crazyhouse: true, taking: true};
72 get pawnPromotions() {
76 genRandInitBaseFen() {
78 fen: "gle/1c1/1C1/ELG",
87 getCurrentScore(move_s
) {
88 const res
= super.getCurrentScore(move_s
);
91 const oppCol
= C
.GetOppTurn(this.turn
);
92 const oppLastRank
= (oppCol
== 'b' ? 3 : 0);
93 for (let j
=0; j
< this.size
.y
; j
++) {
94 if (this.board
[oppLastRank
][j
] == oppCol
+ 'l')
95 return (oppCol
== 'w' ? "1-0" : "0-1");