@@ -988,40 +988,40 @@ export class Chess {
988
988
}
989
989
}
990
990
991
- attackers ( square : Square , attackedBy ?: Color ) {
991
+ attackers ( square : Square , attackedBy ?: Color ) : Square [ ] {
992
992
if ( ! attackedBy ) {
993
993
return this . _attacked ( this . _turn , Ox88 [ square ] , true )
994
994
} else {
995
995
return this . _attacked ( attackedBy , Ox88 [ square ] , true )
996
996
}
997
997
}
998
998
999
- private _isKingAttacked ( color : Color ) {
999
+ private _isKingAttacked ( color : Color ) : boolean {
1000
1000
const square = this . _kings [ color ]
1001
1001
return square === - 1 ? false : this . _attacked ( swapColor ( color ) , square )
1002
1002
}
1003
1003
1004
- isAttacked ( square : Square , attackedBy : Color ) {
1004
+ isAttacked ( square : Square , attackedBy : Color ) : boolean {
1005
1005
return this . _attacked ( attackedBy , Ox88 [ square ] )
1006
1006
}
1007
1007
1008
- isCheck ( ) {
1008
+ isCheck ( ) : boolean {
1009
1009
return this . _isKingAttacked ( this . _turn )
1010
1010
}
1011
1011
1012
- inCheck ( ) {
1012
+ inCheck ( ) : boolean {
1013
1013
return this . isCheck ( )
1014
1014
}
1015
1015
1016
- isCheckmate ( ) {
1016
+ isCheckmate ( ) : boolean {
1017
1017
return this . isCheck ( ) && this . _moves ( ) . length === 0
1018
1018
}
1019
1019
1020
- isStalemate ( ) {
1020
+ isStalemate ( ) : boolean {
1021
1021
return ! this . isCheck ( ) && this . _moves ( ) . length === 0
1022
1022
}
1023
1023
1024
- isInsufficientMaterial ( ) {
1024
+ isInsufficientMaterial ( ) : boolean {
1025
1025
/*
1026
1026
* k.b. vs k.b. (of opposite colors) with mate in 1:
1027
1027
* 8/8/8/8/1b6/8/B1k5/K7 b - - 0 1
0 commit comments