chess4js 1.0.0-beta.6 → 1.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/chess4js.d.mts +7 -1
- package/chess4js.mjs +264 -93
- package/chess4js.mjs.map +1 -1
- package/kotlin-kotlin-stdlib.mjs +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -82,6 +82,15 @@ A non-directly instantiable class representing a 64-bit bitboard. Instances are
|
|
|
82
82
|
|
|
83
83
|
Instances of this class can be obtained from `Position` instances.
|
|
84
84
|
|
|
85
|
+
### Visible squares
|
|
86
|
+
|
|
87
|
+
The visibleSquares function accepts a piece type, a source square, and the current board position to compute the
|
|
88
|
+
visibility bitmask, returning the result as a Bitboard.
|
|
89
|
+
|
|
90
|
+
| Function | Arguments | Return Type | Description |
|
|
91
|
+
|----------------|---------------------------------------------------|-------------|------------------------------------------------------------------------------------------------------|
|
|
92
|
+
| visibleSquares | piece: string, square: string, position: Position | Bitboard | Calculates a bitboard of all squares "visible" or attacked by an specific piece from a given square. |
|
|
93
|
+
|
|
85
94
|
## Move
|
|
86
95
|
|
|
87
96
|
A non directly instantiable class that represents a move made on the board.
|
|
@@ -153,6 +162,8 @@ const somePosition = positionOf("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w K
|
|
|
153
162
|
| enPassantSquare | Nullable\<Square\> | The square exposed to an en passant capture, if one exists. Returns null if no en passant capture is possible in the current position. |
|
|
154
163
|
| gameOver | boolean | True if the game state is concluded (terminal position), either due to a forced draw or checkmate. False otherwise. |
|
|
155
164
|
| sideToMove | Side | The side (WHITE or BLACK) whose turn it is to move. |
|
|
165
|
+
| friends | Bitboard | Returns a bitboard representing the occupancy of all friendly pieces. |
|
|
166
|
+
| enemies | Bitboard | Returns a bitboard representing the occupancy of all enemy pieces. |
|
|
156
167
|
|
|
157
168
|
### Methods
|
|
158
169
|
|
|
@@ -165,6 +176,7 @@ const somePosition = positionOf("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w K
|
|
|
165
176
|
| move | move: Move | Position | Retrieves the new Position that results from executing the provided legal Move. Throws a MoveException if the provided move is not legal in the current position. |
|
|
166
177
|
| moveFromString | move: String, notation: Notation = UCI | Position | Retrieves the new Position that results from executing the move specified in the given notation. Throws a MoveException if the move is not legal. If no notation is provided, UCI notation is assumed. |
|
|
167
178
|
| toString | None | string | retrieves a nice string representation |
|
|
179
|
+
| flipSide | None | Position | Creates a new Position identical to the current one, but with the active side toggled. |
|
|
168
180
|
|
|
169
181
|
### Factories
|
|
170
182
|
|
package/chess4js.d.mts
CHANGED
|
@@ -14,6 +14,8 @@ export declare class Bitboard {
|
|
|
14
14
|
shl(i: number): Bitboard;
|
|
15
15
|
ushr(i: number): Bitboard;
|
|
16
16
|
toArray(): ReadonlyArray<number>;
|
|
17
|
+
bitCount(): number;
|
|
18
|
+
equals(other: Nullable<any>): boolean;
|
|
17
19
|
}
|
|
18
20
|
/** @deprecated $metadata$ is used for internal purposes, please don't use it in your code, because it can be removed at any moment */
|
|
19
21
|
export declare namespace Bitboard.$metadata$ {
|
|
@@ -200,12 +202,15 @@ export declare class Position {
|
|
|
200
202
|
get enPassantSquare(): Nullable<Square>;
|
|
201
203
|
get gameOver(): boolean;
|
|
202
204
|
get sideToMove(): Side;
|
|
205
|
+
get friends(): Bitboard;
|
|
206
|
+
get enemies(): Bitboard;
|
|
203
207
|
whiteLacksOfMaterial(): boolean;
|
|
204
208
|
blackLacksOfMaterial(): boolean;
|
|
205
209
|
pieceAt(square: Square): Piece;
|
|
206
210
|
isLegal(move: Move): boolean;
|
|
207
211
|
move(move: Move): Position;
|
|
208
212
|
moveFromString(move: string, notation?: Notation): Position;
|
|
213
|
+
flipSide(): Position;
|
|
209
214
|
hashCode(): number;
|
|
210
215
|
equals(other: Nullable<any>): boolean;
|
|
211
216
|
toString(): string;
|
|
@@ -357,4 +362,5 @@ export declare function moveOf(move: string): Move;
|
|
|
357
362
|
export declare function analysisGame(idSupplier?: () => Nullable<any>): Game;
|
|
358
363
|
export declare function strictMatch(idSupplier?: () => Nullable<any>): Game;
|
|
359
364
|
export declare function customGame(gameMode: string, threeRepetitionsMode: string, fiftyMovesRuleMode: string, initialFen?: Nullable<string>, idSupplier?: () => Nullable<any>): Game;
|
|
360
|
-
export declare function parseGames(pgnInput: string, idSupplier?: () => Nullable<any>): ReadonlyArray<Game>;
|
|
365
|
+
export declare function parseGames(pgnInput: string, idSupplier?: () => Nullable<any>): ReadonlyArray<Game>;
|
|
366
|
+
export declare function visibleSquares(piece: string, square: string, position: Position): Bitboard;
|
package/chess4js.mjs
CHANGED
|
@@ -88,6 +88,7 @@ import {
|
|
|
88
88
|
toList3jhuyej2anx2q as toList_0,
|
|
89
89
|
countOneBits2h2gnqaw24v9c as countOneBits,
|
|
90
90
|
get_sign1dnxi33u9vk0c as get_sign,
|
|
91
|
+
IllegalStateExceptionkoljg5n0nrlr as IllegalStateException,
|
|
91
92
|
negate13xrbakfwasjy as negate,
|
|
92
93
|
shiftRight2gqph14wydb8s as shiftRight,
|
|
93
94
|
until1jbpn0z3f8lbg as until,
|
|
@@ -2118,6 +2119,22 @@ class Bitboard {
|
|
|
2118
2119
|
toArray() {
|
|
2119
2120
|
return toList(bitboardToSequence(this.zq_1, Bitboard$toArray$lambda)).e2();
|
|
2120
2121
|
}
|
|
2122
|
+
bitCount() {
|
|
2123
|
+
return countOneBits(this.zq_1);
|
|
2124
|
+
}
|
|
2125
|
+
equals(other) {
|
|
2126
|
+
if (this === other)
|
|
2127
|
+
return true;
|
|
2128
|
+
if (other == null)
|
|
2129
|
+
return false;
|
|
2130
|
+
var tmp;
|
|
2131
|
+
if (other instanceof Bitboard) {
|
|
2132
|
+
tmp = this.zq_1 === other.zq_1;
|
|
2133
|
+
} else {
|
|
2134
|
+
tmp = false;
|
|
2135
|
+
}
|
|
2136
|
+
return tmp;
|
|
2137
|
+
}
|
|
2121
2138
|
}
|
|
2122
2139
|
class EcoInfo_0 {
|
|
2123
2140
|
constructor(backedEcoInfo) {
|
|
@@ -2647,31 +2664,34 @@ class Position_0 {
|
|
|
2647
2664
|
this.movesCounter = this.gs_1.lj_1;
|
|
2648
2665
|
this.halfMovesCounter = this.gs_1.mj_1;
|
|
2649
2666
|
}
|
|
2667
|
+
hs() {
|
|
2668
|
+
return this.gs_1;
|
|
2669
|
+
}
|
|
2650
2670
|
fq() {
|
|
2651
2671
|
return this.bitboards;
|
|
2652
2672
|
}
|
|
2653
|
-
|
|
2673
|
+
is() {
|
|
2654
2674
|
return this.whiteMove;
|
|
2655
2675
|
}
|
|
2656
|
-
|
|
2676
|
+
js() {
|
|
2657
2677
|
return this.enPassant;
|
|
2658
2678
|
}
|
|
2659
|
-
|
|
2679
|
+
ks() {
|
|
2660
2680
|
return this.whiteCastleKingside;
|
|
2661
2681
|
}
|
|
2662
|
-
|
|
2682
|
+
ls() {
|
|
2663
2683
|
return this.whiteCastleQueenside;
|
|
2664
2684
|
}
|
|
2665
|
-
|
|
2685
|
+
ms() {
|
|
2666
2686
|
return this.blackCastleKingside;
|
|
2667
2687
|
}
|
|
2668
|
-
|
|
2688
|
+
ns() {
|
|
2669
2689
|
return this.blackCastleQueenside;
|
|
2670
2690
|
}
|
|
2671
|
-
|
|
2691
|
+
os() {
|
|
2672
2692
|
return this.movesCounter;
|
|
2673
2693
|
}
|
|
2674
|
-
|
|
2694
|
+
ps() {
|
|
2675
2695
|
return this.halfMovesCounter;
|
|
2676
2696
|
}
|
|
2677
2697
|
gq() {
|
|
@@ -2712,10 +2732,10 @@ class Position_0 {
|
|
|
2712
2732
|
}
|
|
2713
2733
|
return destination.e2();
|
|
2714
2734
|
}
|
|
2715
|
-
|
|
2735
|
+
qs() {
|
|
2716
2736
|
return get_draw(this.gs_1);
|
|
2717
2737
|
}
|
|
2718
|
-
|
|
2738
|
+
rs() {
|
|
2719
2739
|
var tmp0_safe_receiver = get_enPassantSquare(this.gs_1);
|
|
2720
2740
|
var tmp;
|
|
2721
2741
|
if (tmp0_safe_receiver == null) {
|
|
@@ -2726,12 +2746,18 @@ class Position_0 {
|
|
|
2726
2746
|
}
|
|
2727
2747
|
return tmp;
|
|
2728
2748
|
}
|
|
2729
|
-
|
|
2749
|
+
ss() {
|
|
2730
2750
|
return get_gameOver(this.gs_1);
|
|
2731
2751
|
}
|
|
2732
|
-
|
|
2752
|
+
ts() {
|
|
2733
2753
|
return ensureNotNull(Companion_getInstance_10().get(get_sideToMove(this.gs_1).l2_1));
|
|
2734
2754
|
}
|
|
2755
|
+
us() {
|
|
2756
|
+
return new Bitboard(get_friends(this.gs_1));
|
|
2757
|
+
}
|
|
2758
|
+
vs() {
|
|
2759
|
+
return new Bitboard(get_enemies(this.gs_1));
|
|
2760
|
+
}
|
|
2735
2761
|
whiteLacksOfMaterial() {
|
|
2736
2762
|
return whiteLacksOfMaterial(this.gs_1);
|
|
2737
2763
|
}
|
|
@@ -2747,12 +2773,15 @@ class Position_0 {
|
|
|
2747
2773
|
move(move_0) {
|
|
2748
2774
|
return new Position_0(move(this.gs_1, move_0.backedMove));
|
|
2749
2775
|
}
|
|
2750
|
-
|
|
2776
|
+
ws(move, notation) {
|
|
2751
2777
|
return new Position_0(move_0(this.gs_1, move, valueOf_3(notation.name)));
|
|
2752
2778
|
}
|
|
2753
2779
|
moveFromString(move, notation, $super) {
|
|
2754
2780
|
notation = notation === VOID ? get_UCI() : notation;
|
|
2755
|
-
return $super === VOID ? this.
|
|
2781
|
+
return $super === VOID ? this.ws(move, notation) : $super.ws.call(this, move, notation);
|
|
2782
|
+
}
|
|
2783
|
+
flipSide() {
|
|
2784
|
+
return new Position_0(flipSide(this.gs_1));
|
|
2756
2785
|
}
|
|
2757
2786
|
hashCode() {
|
|
2758
2787
|
return this.gs_1.hashCode();
|
|
@@ -2797,16 +2826,22 @@ class Position_0 {
|
|
|
2797
2826
|
return this.bj();
|
|
2798
2827
|
}
|
|
2799
2828
|
get draw() {
|
|
2800
|
-
return this.
|
|
2829
|
+
return this.qs();
|
|
2801
2830
|
}
|
|
2802
2831
|
get enPassantSquare() {
|
|
2803
|
-
return this.
|
|
2832
|
+
return this.rs();
|
|
2804
2833
|
}
|
|
2805
2834
|
get gameOver() {
|
|
2806
|
-
return this.
|
|
2835
|
+
return this.ss();
|
|
2807
2836
|
}
|
|
2808
2837
|
get sideToMove() {
|
|
2809
|
-
return this.
|
|
2838
|
+
return this.ts();
|
|
2839
|
+
}
|
|
2840
|
+
get friends() {
|
|
2841
|
+
return this.us();
|
|
2842
|
+
}
|
|
2843
|
+
get enemies() {
|
|
2844
|
+
return this.vs();
|
|
2810
2845
|
}
|
|
2811
2846
|
}
|
|
2812
2847
|
class Companion_10 {
|
|
@@ -2823,7 +2858,7 @@ class Companion_10 {
|
|
|
2823
2858
|
var tmp$ret$0 = new Side_0(item.l2_1);
|
|
2824
2859
|
destination.k(tmp$ret$0);
|
|
2825
2860
|
}
|
|
2826
|
-
tmp.
|
|
2861
|
+
tmp.xs_1 = destination;
|
|
2827
2862
|
var tmp_0 = this;
|
|
2828
2863
|
// Inline function 'kotlin.collections.map' call
|
|
2829
2864
|
var this_1 = get_entries_1();
|
|
@@ -2849,16 +2884,16 @@ class Companion_10 {
|
|
|
2849
2884
|
var pair = to(element.l2_1, new Side_0(element.l2_1));
|
|
2850
2885
|
destination_1.f5(pair.md_1, pair.nd_1);
|
|
2851
2886
|
}
|
|
2852
|
-
tmp_1.
|
|
2887
|
+
tmp_1.ys_1 = destination_1;
|
|
2853
2888
|
}
|
|
2854
2889
|
es() {
|
|
2855
|
-
return this.
|
|
2890
|
+
return this.xs_1;
|
|
2856
2891
|
}
|
|
2857
2892
|
k2() {
|
|
2858
2893
|
return this.entries;
|
|
2859
2894
|
}
|
|
2860
2895
|
get(name) {
|
|
2861
|
-
return this.
|
|
2896
|
+
return this.ys_1.j2(name);
|
|
2862
2897
|
}
|
|
2863
2898
|
}
|
|
2864
2899
|
class Side_0 {
|
|
@@ -2896,7 +2931,7 @@ class Companion_11 {
|
|
|
2896
2931
|
var tmp$ret$3 = new Square_0(item_0.m2_1, item_0.l2_1);
|
|
2897
2932
|
destination_0.k(tmp$ret$3);
|
|
2898
2933
|
}
|
|
2899
|
-
tmp_0.
|
|
2934
|
+
tmp_0.zs_1 = destination_0;
|
|
2900
2935
|
var tmp_1 = this;
|
|
2901
2936
|
// Inline function 'kotlin.collections.associate' call
|
|
2902
2937
|
var this_2 = get_entries_2();
|
|
@@ -2910,19 +2945,19 @@ class Companion_11 {
|
|
|
2910
2945
|
var pair = to(element.l2_1, new Square_0(element.m2_1, element.l2_1));
|
|
2911
2946
|
destination_1.f5(pair.md_1, pair.nd_1);
|
|
2912
2947
|
}
|
|
2913
|
-
tmp_1.
|
|
2948
|
+
tmp_1.at_1 = destination_1;
|
|
2914
2949
|
}
|
|
2915
2950
|
k2() {
|
|
2916
2951
|
return this.entries;
|
|
2917
2952
|
}
|
|
2918
2953
|
es() {
|
|
2919
|
-
return this.
|
|
2954
|
+
return this.zs_1;
|
|
2920
2955
|
}
|
|
2921
2956
|
get(name) {
|
|
2922
|
-
return this.
|
|
2957
|
+
return this.at_1.j2(name);
|
|
2923
2958
|
}
|
|
2924
2959
|
indexToSquare(index) {
|
|
2925
|
-
return this.
|
|
2960
|
+
return this.zs_1.c1(index);
|
|
2926
2961
|
}
|
|
2927
2962
|
}
|
|
2928
2963
|
class Square_0 {
|
|
@@ -5595,6 +5630,42 @@ function moveOf_2(move) {
|
|
|
5595
5630
|
_init_properties_factory_kt__5kmpyw();
|
|
5596
5631
|
return get_moveFromString()(move);
|
|
5597
5632
|
}
|
|
5633
|
+
function visibleSquares_0(piece, square, position) {
|
|
5634
|
+
_init_properties_factory_kt__5kmpyw();
|
|
5635
|
+
var tmp;
|
|
5636
|
+
switch (piece.m2_1) {
|
|
5637
|
+
case 1:
|
|
5638
|
+
tmp = get_visibleSquaresWhitePawn()(square.m2_1, get_friends(position));
|
|
5639
|
+
break;
|
|
5640
|
+
case 2:
|
|
5641
|
+
case 8:
|
|
5642
|
+
tmp = get_visibleSquaresKnight()(square.m2_1, get_friends(position));
|
|
5643
|
+
break;
|
|
5644
|
+
case 3:
|
|
5645
|
+
case 9:
|
|
5646
|
+
tmp = get_visibleSquaresBishop()(square.m2_1, get_friends(position), get_enemies(position));
|
|
5647
|
+
break;
|
|
5648
|
+
case 4:
|
|
5649
|
+
case 10:
|
|
5650
|
+
tmp = get_visibleSquaresRook()(square.m2_1, get_friends(position), get_enemies(position));
|
|
5651
|
+
break;
|
|
5652
|
+
case 5:
|
|
5653
|
+
case 11:
|
|
5654
|
+
tmp = get_visibleSquaresQueen()(square.m2_1, get_friends(position), get_enemies(position));
|
|
5655
|
+
break;
|
|
5656
|
+
case 6:
|
|
5657
|
+
case 12:
|
|
5658
|
+
tmp = get_visibleSquaresKing()(square.m2_1, get_friends(position));
|
|
5659
|
+
break;
|
|
5660
|
+
case 7:
|
|
5661
|
+
tmp = get_visibleSquaresBlackPawn()(square.m2_1, get_friends(position));
|
|
5662
|
+
break;
|
|
5663
|
+
default:
|
|
5664
|
+
var message = 'Invalid piece ' + piece.toString();
|
|
5665
|
+
throw IllegalStateException.e3(toString(message));
|
|
5666
|
+
}
|
|
5667
|
+
return tmp;
|
|
5668
|
+
}
|
|
5598
5669
|
function positionOf() {
|
|
5599
5670
|
_init_properties_factory_kt__5kmpyw();
|
|
5600
5671
|
return get_startpos();
|
|
@@ -10432,6 +10503,83 @@ function toSan_0(position, move_0, pieces) {
|
|
|
10432
10503
|
}
|
|
10433
10504
|
return sbSAN.toString();
|
|
10434
10505
|
}
|
|
10506
|
+
function get_friends(_this__u8e3s4) {
|
|
10507
|
+
_init_properties_util_kt__mcwhvi();
|
|
10508
|
+
var tmp;
|
|
10509
|
+
if (_this__u8e3s4.fj_1) {
|
|
10510
|
+
// Inline function 'kotlin.arrayOf' call
|
|
10511
|
+
// Inline function 'kotlin.js.unsafeCast' call
|
|
10512
|
+
// Inline function 'kotlin.js.asDynamic' call
|
|
10513
|
+
var tmp$ret$2 = [Piece_WP_getInstance(), Piece_WN_getInstance(), Piece_WB_getInstance(), Piece_WR_getInstance(), Piece_WQ_getInstance(), Piece_WK_getInstance()];
|
|
10514
|
+
var tmp_0 = asSequence_2(tmp$ret$2);
|
|
10515
|
+
// Inline function 'kotlin.sequences.fold' call
|
|
10516
|
+
var accumulator = 0n;
|
|
10517
|
+
var _iterator__ex2g4s = map(tmp_0, _get_friends_$lambda_r7z9e7(_this__u8e3s4)).x();
|
|
10518
|
+
while (_iterator__ex2g4s.z()) {
|
|
10519
|
+
var element = _iterator__ex2g4s.a1();
|
|
10520
|
+
accumulator = accumulator | element;
|
|
10521
|
+
}
|
|
10522
|
+
tmp = accumulator;
|
|
10523
|
+
} else {
|
|
10524
|
+
// Inline function 'kotlin.arrayOf' call
|
|
10525
|
+
// Inline function 'kotlin.js.unsafeCast' call
|
|
10526
|
+
// Inline function 'kotlin.js.asDynamic' call
|
|
10527
|
+
var tmp$ret$7 = [Piece_BP_getInstance(), Piece_BN_getInstance(), Piece_BB_getInstance(), Piece_BR_getInstance(), Piece_BQ_getInstance(), Piece_BK_getInstance()];
|
|
10528
|
+
var tmp_1 = asSequence_2(tmp$ret$7);
|
|
10529
|
+
// Inline function 'kotlin.sequences.fold' call
|
|
10530
|
+
var accumulator_0 = 0n;
|
|
10531
|
+
var _iterator__ex2g4s_0 = map(tmp_1, _get_friends_$lambda_r7z9e7_0(_this__u8e3s4)).x();
|
|
10532
|
+
while (_iterator__ex2g4s_0.z()) {
|
|
10533
|
+
var element_0 = _iterator__ex2g4s_0.a1();
|
|
10534
|
+
accumulator_0 = accumulator_0 | element_0;
|
|
10535
|
+
}
|
|
10536
|
+
tmp = accumulator_0;
|
|
10537
|
+
}
|
|
10538
|
+
return tmp;
|
|
10539
|
+
}
|
|
10540
|
+
function get_enemies(_this__u8e3s4) {
|
|
10541
|
+
_init_properties_util_kt__mcwhvi();
|
|
10542
|
+
var tmp;
|
|
10543
|
+
if (_this__u8e3s4.fj_1) {
|
|
10544
|
+
// Inline function 'kotlin.arrayOf' call
|
|
10545
|
+
// Inline function 'kotlin.js.unsafeCast' call
|
|
10546
|
+
// Inline function 'kotlin.js.asDynamic' call
|
|
10547
|
+
var tmp$ret$2 = [Piece_BP_getInstance(), Piece_BN_getInstance(), Piece_BB_getInstance(), Piece_BR_getInstance(), Piece_BQ_getInstance(), Piece_BK_getInstance()];
|
|
10548
|
+
var tmp_0 = asSequence_2(tmp$ret$2);
|
|
10549
|
+
// Inline function 'kotlin.sequences.fold' call
|
|
10550
|
+
var accumulator = 0n;
|
|
10551
|
+
var _iterator__ex2g4s = map(tmp_0, _get_enemies_$lambda_4gx6u8(_this__u8e3s4)).x();
|
|
10552
|
+
while (_iterator__ex2g4s.z()) {
|
|
10553
|
+
var element = _iterator__ex2g4s.a1();
|
|
10554
|
+
accumulator = accumulator | element;
|
|
10555
|
+
}
|
|
10556
|
+
tmp = accumulator;
|
|
10557
|
+
} else {
|
|
10558
|
+
// Inline function 'kotlin.arrayOf' call
|
|
10559
|
+
// Inline function 'kotlin.js.unsafeCast' call
|
|
10560
|
+
// Inline function 'kotlin.js.asDynamic' call
|
|
10561
|
+
var tmp$ret$7 = [Piece_WP_getInstance(), Piece_WN_getInstance(), Piece_WB_getInstance(), Piece_WR_getInstance(), Piece_WQ_getInstance(), Piece_WK_getInstance()];
|
|
10562
|
+
var tmp_1 = asSequence_2(tmp$ret$7);
|
|
10563
|
+
// Inline function 'kotlin.sequences.fold' call
|
|
10564
|
+
var accumulator_0 = 0n;
|
|
10565
|
+
var _iterator__ex2g4s_0 = map(tmp_1, _get_enemies_$lambda_4gx6u8_0(_this__u8e3s4)).x();
|
|
10566
|
+
while (_iterator__ex2g4s_0.z()) {
|
|
10567
|
+
var element_0 = _iterator__ex2g4s_0.a1();
|
|
10568
|
+
accumulator_0 = accumulator_0 | element_0;
|
|
10569
|
+
}
|
|
10570
|
+
tmp = accumulator_0;
|
|
10571
|
+
}
|
|
10572
|
+
return tmp;
|
|
10573
|
+
}
|
|
10574
|
+
function flipSide(_this__u8e3s4) {
|
|
10575
|
+
_init_properties_util_kt__mcwhvi();
|
|
10576
|
+
if (_this__u8e3s4.hq() || _this__u8e3s4.gq()) {
|
|
10577
|
+
// Inline function 'kotlin.error' call
|
|
10578
|
+
var message = "this position can't be flipped because it derives to an illegal position";
|
|
10579
|
+
throw IllegalStateException.e3(toString(message));
|
|
10580
|
+
}
|
|
10581
|
+
return Position.oq(_this__u8e3s4.fq(), !_this__u8e3s4.fj_1, _this__u8e3s4.gj_1, _this__u8e3s4.hj_1, _this__u8e3s4.ij_1, _this__u8e3s4.jj_1, _this__u8e3s4.kj_1, _this__u8e3s4.lj_1, _this__u8e3s4.mj_1);
|
|
10582
|
+
}
|
|
10435
10583
|
function toSquares$lambda(it) {
|
|
10436
10584
|
_init_properties_util_kt__mcwhvi();
|
|
10437
10585
|
return Companion_instance_6.c1(countTrailingZeroBits(it));
|
|
@@ -10501,6 +10649,18 @@ function toSan$lambda_1($position, $move) {
|
|
|
10501
10649
|
function toSan$lambda_2($move) {
|
|
10502
10650
|
return (m) => !(m.qn_1 === $move.qn_1);
|
|
10503
10651
|
}
|
|
10652
|
+
function _get_friends_$lambda_r7z9e7($this_friends) {
|
|
10653
|
+
return (p) => $this_friends.fq()[p.m2_1 - 1 | 0];
|
|
10654
|
+
}
|
|
10655
|
+
function _get_friends_$lambda_r7z9e7_0($this_friends) {
|
|
10656
|
+
return (p) => $this_friends.fq()[p.m2_1 - 1 | 0];
|
|
10657
|
+
}
|
|
10658
|
+
function _get_enemies_$lambda_4gx6u8($this_enemies) {
|
|
10659
|
+
return (p) => $this_enemies.fq()[p.m2_1 - 1 | 0];
|
|
10660
|
+
}
|
|
10661
|
+
function _get_enemies_$lambda_4gx6u8_0($this_enemies) {
|
|
10662
|
+
return (p) => $this_enemies.fq()[p.m2_1 - 1 | 0];
|
|
10663
|
+
}
|
|
10504
10664
|
var properties_initialized_util_kt_qfsh5w;
|
|
10505
10665
|
function _init_properties_util_kt__mcwhvi() {
|
|
10506
10666
|
if (!properties_initialized_util_kt_qfsh5w) {
|
|
@@ -11054,8 +11214,8 @@ var properties_initialized_Side_kt_xjv14p;
|
|
|
11054
11214
|
function _init_properties_Side_kt__trrix5() {
|
|
11055
11215
|
if (!properties_initialized_Side_kt_xjv14p) {
|
|
11056
11216
|
properties_initialized_Side_kt_xjv14p = true;
|
|
11057
|
-
WHITE_0 = Companion_getInstance_10().
|
|
11058
|
-
BLACK_0 = Companion_getInstance_10().
|
|
11217
|
+
WHITE_0 = Companion_getInstance_10().xs_1.c1(0);
|
|
11218
|
+
BLACK_0 = Companion_getInstance_10().xs_1.c1(1);
|
|
11059
11219
|
}
|
|
11060
11220
|
}
|
|
11061
11221
|
function get_A1() {
|
|
@@ -11388,70 +11548,70 @@ var properties_initialized_Square_kt_d57phb;
|
|
|
11388
11548
|
function _init_properties_Square_kt__qeygot() {
|
|
11389
11549
|
if (!properties_initialized_Square_kt_d57phb) {
|
|
11390
11550
|
properties_initialized_Square_kt_d57phb = true;
|
|
11391
|
-
A1_0 = Companion_getInstance_11().
|
|
11392
|
-
B1_0 = Companion_getInstance_11().
|
|
11393
|
-
C1_0 = Companion_getInstance_11().
|
|
11394
|
-
D1_0 = Companion_getInstance_11().
|
|
11395
|
-
E1_0 = Companion_getInstance_11().
|
|
11396
|
-
F1_0 = Companion_getInstance_11().
|
|
11397
|
-
G1_0 = Companion_getInstance_11().
|
|
11398
|
-
H1_0 = Companion_getInstance_11().
|
|
11399
|
-
A2_0 = Companion_getInstance_11().
|
|
11400
|
-
B2_0 = Companion_getInstance_11().
|
|
11401
|
-
C2_0 = Companion_getInstance_11().
|
|
11402
|
-
D2_0 = Companion_getInstance_11().
|
|
11403
|
-
E2_0 = Companion_getInstance_11().
|
|
11404
|
-
F2_0 = Companion_getInstance_11().
|
|
11405
|
-
G2_0 = Companion_getInstance_11().
|
|
11406
|
-
H2_0 = Companion_getInstance_11().
|
|
11407
|
-
A3_0 = Companion_getInstance_11().
|
|
11408
|
-
B3_0 = Companion_getInstance_11().
|
|
11409
|
-
C3_0 = Companion_getInstance_11().
|
|
11410
|
-
D3_0 = Companion_getInstance_11().
|
|
11411
|
-
E3_0 = Companion_getInstance_11().
|
|
11412
|
-
F3_0 = Companion_getInstance_11().
|
|
11413
|
-
G3_0 = Companion_getInstance_11().
|
|
11414
|
-
H3_0 = Companion_getInstance_11().
|
|
11415
|
-
A4_0 = Companion_getInstance_11().
|
|
11416
|
-
B4_0 = Companion_getInstance_11().
|
|
11417
|
-
C4_0 = Companion_getInstance_11().
|
|
11418
|
-
D4_0 = Companion_getInstance_11().
|
|
11419
|
-
E4_0 = Companion_getInstance_11().
|
|
11420
|
-
F4_0 = Companion_getInstance_11().
|
|
11421
|
-
G4_0 = Companion_getInstance_11().
|
|
11422
|
-
H4_0 = Companion_getInstance_11().
|
|
11423
|
-
A5_0 = Companion_getInstance_11().
|
|
11424
|
-
B5_0 = Companion_getInstance_11().
|
|
11425
|
-
C5_0 = Companion_getInstance_11().
|
|
11426
|
-
D5_0 = Companion_getInstance_11().
|
|
11427
|
-
E5_0 = Companion_getInstance_11().
|
|
11428
|
-
F5_0 = Companion_getInstance_11().
|
|
11429
|
-
G5_0 = Companion_getInstance_11().
|
|
11430
|
-
H5_0 = Companion_getInstance_11().
|
|
11431
|
-
A6_0 = Companion_getInstance_11().
|
|
11432
|
-
B6_0 = Companion_getInstance_11().
|
|
11433
|
-
C6_0 = Companion_getInstance_11().
|
|
11434
|
-
D6_0 = Companion_getInstance_11().
|
|
11435
|
-
E6_0 = Companion_getInstance_11().
|
|
11436
|
-
F6_0 = Companion_getInstance_11().
|
|
11437
|
-
G6_0 = Companion_getInstance_11().
|
|
11438
|
-
H6_0 = Companion_getInstance_11().
|
|
11439
|
-
A7_0 = Companion_getInstance_11().
|
|
11440
|
-
B7_0 = Companion_getInstance_11().
|
|
11441
|
-
C7_0 = Companion_getInstance_11().
|
|
11442
|
-
D7_0 = Companion_getInstance_11().
|
|
11443
|
-
E7_0 = Companion_getInstance_11().
|
|
11444
|
-
F7_0 = Companion_getInstance_11().
|
|
11445
|
-
G7_0 = Companion_getInstance_11().
|
|
11446
|
-
H7_0 = Companion_getInstance_11().
|
|
11447
|
-
A8_0 = Companion_getInstance_11().
|
|
11448
|
-
B8_0 = Companion_getInstance_11().
|
|
11449
|
-
C8_0 = Companion_getInstance_11().
|
|
11450
|
-
D8_0 = Companion_getInstance_11().
|
|
11451
|
-
E8_0 = Companion_getInstance_11().
|
|
11452
|
-
F8_0 = Companion_getInstance_11().
|
|
11453
|
-
G8_0 = Companion_getInstance_11().
|
|
11454
|
-
H8_0 = Companion_getInstance_11().
|
|
11551
|
+
A1_0 = Companion_getInstance_11().zs_1.c1(0);
|
|
11552
|
+
B1_0 = Companion_getInstance_11().zs_1.c1(1);
|
|
11553
|
+
C1_0 = Companion_getInstance_11().zs_1.c1(2);
|
|
11554
|
+
D1_0 = Companion_getInstance_11().zs_1.c1(3);
|
|
11555
|
+
E1_0 = Companion_getInstance_11().zs_1.c1(4);
|
|
11556
|
+
F1_0 = Companion_getInstance_11().zs_1.c1(5);
|
|
11557
|
+
G1_0 = Companion_getInstance_11().zs_1.c1(6);
|
|
11558
|
+
H1_0 = Companion_getInstance_11().zs_1.c1(7);
|
|
11559
|
+
A2_0 = Companion_getInstance_11().zs_1.c1(8);
|
|
11560
|
+
B2_0 = Companion_getInstance_11().zs_1.c1(9);
|
|
11561
|
+
C2_0 = Companion_getInstance_11().zs_1.c1(10);
|
|
11562
|
+
D2_0 = Companion_getInstance_11().zs_1.c1(11);
|
|
11563
|
+
E2_0 = Companion_getInstance_11().zs_1.c1(12);
|
|
11564
|
+
F2_0 = Companion_getInstance_11().zs_1.c1(13);
|
|
11565
|
+
G2_0 = Companion_getInstance_11().zs_1.c1(14);
|
|
11566
|
+
H2_0 = Companion_getInstance_11().zs_1.c1(15);
|
|
11567
|
+
A3_0 = Companion_getInstance_11().zs_1.c1(16);
|
|
11568
|
+
B3_0 = Companion_getInstance_11().zs_1.c1(17);
|
|
11569
|
+
C3_0 = Companion_getInstance_11().zs_1.c1(18);
|
|
11570
|
+
D3_0 = Companion_getInstance_11().zs_1.c1(19);
|
|
11571
|
+
E3_0 = Companion_getInstance_11().zs_1.c1(20);
|
|
11572
|
+
F3_0 = Companion_getInstance_11().zs_1.c1(21);
|
|
11573
|
+
G3_0 = Companion_getInstance_11().zs_1.c1(22);
|
|
11574
|
+
H3_0 = Companion_getInstance_11().zs_1.c1(23);
|
|
11575
|
+
A4_0 = Companion_getInstance_11().zs_1.c1(24);
|
|
11576
|
+
B4_0 = Companion_getInstance_11().zs_1.c1(25);
|
|
11577
|
+
C4_0 = Companion_getInstance_11().zs_1.c1(26);
|
|
11578
|
+
D4_0 = Companion_getInstance_11().zs_1.c1(27);
|
|
11579
|
+
E4_0 = Companion_getInstance_11().zs_1.c1(28);
|
|
11580
|
+
F4_0 = Companion_getInstance_11().zs_1.c1(29);
|
|
11581
|
+
G4_0 = Companion_getInstance_11().zs_1.c1(30);
|
|
11582
|
+
H4_0 = Companion_getInstance_11().zs_1.c1(31);
|
|
11583
|
+
A5_0 = Companion_getInstance_11().zs_1.c1(32);
|
|
11584
|
+
B5_0 = Companion_getInstance_11().zs_1.c1(33);
|
|
11585
|
+
C5_0 = Companion_getInstance_11().zs_1.c1(34);
|
|
11586
|
+
D5_0 = Companion_getInstance_11().zs_1.c1(35);
|
|
11587
|
+
E5_0 = Companion_getInstance_11().zs_1.c1(36);
|
|
11588
|
+
F5_0 = Companion_getInstance_11().zs_1.c1(37);
|
|
11589
|
+
G5_0 = Companion_getInstance_11().zs_1.c1(38);
|
|
11590
|
+
H5_0 = Companion_getInstance_11().zs_1.c1(39);
|
|
11591
|
+
A6_0 = Companion_getInstance_11().zs_1.c1(40);
|
|
11592
|
+
B6_0 = Companion_getInstance_11().zs_1.c1(41);
|
|
11593
|
+
C6_0 = Companion_getInstance_11().zs_1.c1(42);
|
|
11594
|
+
D6_0 = Companion_getInstance_11().zs_1.c1(43);
|
|
11595
|
+
E6_0 = Companion_getInstance_11().zs_1.c1(44);
|
|
11596
|
+
F6_0 = Companion_getInstance_11().zs_1.c1(45);
|
|
11597
|
+
G6_0 = Companion_getInstance_11().zs_1.c1(46);
|
|
11598
|
+
H6_0 = Companion_getInstance_11().zs_1.c1(47);
|
|
11599
|
+
A7_0 = Companion_getInstance_11().zs_1.c1(48);
|
|
11600
|
+
B7_0 = Companion_getInstance_11().zs_1.c1(49);
|
|
11601
|
+
C7_0 = Companion_getInstance_11().zs_1.c1(50);
|
|
11602
|
+
D7_0 = Companion_getInstance_11().zs_1.c1(51);
|
|
11603
|
+
E7_0 = Companion_getInstance_11().zs_1.c1(52);
|
|
11604
|
+
F7_0 = Companion_getInstance_11().zs_1.c1(53);
|
|
11605
|
+
G7_0 = Companion_getInstance_11().zs_1.c1(54);
|
|
11606
|
+
H7_0 = Companion_getInstance_11().zs_1.c1(55);
|
|
11607
|
+
A8_0 = Companion_getInstance_11().zs_1.c1(56);
|
|
11608
|
+
B8_0 = Companion_getInstance_11().zs_1.c1(57);
|
|
11609
|
+
C8_0 = Companion_getInstance_11().zs_1.c1(58);
|
|
11610
|
+
D8_0 = Companion_getInstance_11().zs_1.c1(59);
|
|
11611
|
+
E8_0 = Companion_getInstance_11().zs_1.c1(60);
|
|
11612
|
+
F8_0 = Companion_getInstance_11().zs_1.c1(61);
|
|
11613
|
+
G8_0 = Companion_getInstance_11().zs_1.c1(62);
|
|
11614
|
+
H8_0 = Companion_getInstance_11().zs_1.c1(63);
|
|
11455
11615
|
}
|
|
11456
11616
|
}
|
|
11457
11617
|
var Companion_instance_12;
|
|
@@ -11553,6 +11713,16 @@ function _init_properties_factory_kt__5kmpyw_0() {
|
|
|
11553
11713
|
initialPosition = new Position_0(positionOf());
|
|
11554
11714
|
}
|
|
11555
11715
|
}
|
|
11716
|
+
function visibleSquares_1(piece, square, position) {
|
|
11717
|
+
// Inline function 'kotlin.text.uppercase' call
|
|
11718
|
+
// Inline function 'kotlin.js.asDynamic' call
|
|
11719
|
+
var tmp$ret$1 = piece.toUpperCase();
|
|
11720
|
+
var tmp = valueOf_4(tmp$ret$1);
|
|
11721
|
+
// Inline function 'kotlin.text.uppercase' call
|
|
11722
|
+
// Inline function 'kotlin.js.asDynamic' call
|
|
11723
|
+
var tmp$ret$3 = square.toUpperCase();
|
|
11724
|
+
return new Bitboard(visibleSquares_0(tmp, valueOf_5(tmp$ret$3), position.gs_1));
|
|
11725
|
+
}
|
|
11556
11726
|
//region block: post-declaration
|
|
11557
11727
|
initMetadataForCompanion(Companion);
|
|
11558
11728
|
initMetadataForClass(CastleInfo, 'CastleInfo');
|
|
@@ -11829,6 +11999,7 @@ export {
|
|
|
11829
11999
|
strictMatch_0 as strictMatch,
|
|
11830
12000
|
customGame_0 as customGame,
|
|
11831
12001
|
parseGames_0 as parseGames,
|
|
12002
|
+
visibleSquares_1 as visibleSquares,
|
|
11832
12003
|
};
|
|
11833
12004
|
//endregion
|
|
11834
12005
|
|