diff --git a/src/starfish/internal/game.gleam b/src/starfish/internal/game.gleam index b616832..a6488df 100644 --- a/src/starfish/internal/game.gleam +++ b/src/starfish/internal/game.gleam @@ -464,14 +464,17 @@ fn castling_to_string(castling: Castling) -> String { } pub fn is_insufficient_material(game: Game) -> Bool { - { - game.black_pieces.pawn_material == 0 && game.white_pieces.pawn_material == 0 - } + game.black_pieces.pawn_material == 0 + && game.white_pieces.pawn_material == 0 && { game.black_pieces.non_pawn_material == board.bishop_value || game.black_pieces.non_pawn_material == board.knight_value - || game.white_pieces.non_pawn_material == board.bishop_value + || game.black_pieces.non_pawn_material == 0 + } + && { + game.white_pieces.non_pawn_material == board.bishop_value || game.white_pieces.non_pawn_material == board.knight_value + || game.white_pieces.non_pawn_material == 0 } }