Attempt to clarify installation instructions a little
[vchess.git] / client / src / variants / Crossing.js
CommitLineData
0f7762c1
BA
1import { ChessRules } from "@/base_rules";
2
3export class CrossingRules extends ChessRules {
4
5 static get Lines() {
6 return [ [[4, 0], [4, 8]] ];
7 }
8
9 getCurrentScore() {
10 // Turn has changed:
11 const color = V.GetOppCol(this.turn);
12 const secondHalf = (color == 'w' ? [0, 1, 2, 3] : [4, 5, 6, 7]);
13 if (secondHalf.includes(this.kingPos[color][0]))
14 // Half-board is crossed
15 return color == "w" ? "1-0" : "0-1";
16 return super.getCurrentScore();
17 }
18
19 evalPosition() {
20 // Count material:
21 let evaluation = super.evalPosition();
22 // Ponder with king position:
23 return (
24 evaluation/5 +
25 Math.abs(this.kingPos["w"][0] - 3.5) -
26 Math.abs(this.kingPos["b"][0] - 3.5)
27 );
28 }
29
30};