I found that parsing of pieces in hands doesn't properly handle the case when the number of pieces are 10 (2 digit number) or more. In this example, White should have 17 Pawns, but it results in 7:
use shogi::{Move, Position, Color, Piece, Square};
use shogi::bitboard::Factory as BBFactory;
use shogi::piece_type::PieceType;
fn main() {
BBFactory::init();
let mut pos = Position::new();
let sfen = "7k1/9/7P1/9/9/9/9/9/9 b G2r2b3g4s4n4l17p 1";
pos.set_sfen(sfen).unwrap();
assert_eq!(pos.hand(Piece{piece_type: PieceType::Pawn, color: Color::White}), 17, "pawn count");
}
I found that parsing of pieces in hands doesn't properly handle the case when the number of pieces are 10 (2 digit number) or more. In this example,
White
should have 17 Pawns, but it results in 7:parse_sfen_hand
seems to omit leading digits.