[board] Replace active player and move properties on Board with MoveCounter instance
This commit is contained in:
parent
58cbe07136
commit
cd60a453aa
3 changed files with 24 additions and 49 deletions
|
@ -132,8 +132,10 @@ impl ToFenStr for Board {
|
|||
)
|
||||
.map_err(ToFenStrError::FmtError)?;
|
||||
|
||||
write!(fen_string, " {}", self.ply_counter()).map_err(ToFenStrError::FmtError)?;
|
||||
write!(fen_string, " {}", self.move_number()).map_err(ToFenStrError::FmtError)?;
|
||||
write!(fen_string, " {}", self.move_counter.halfmove_number)
|
||||
.map_err(ToFenStrError::FmtError)?;
|
||||
write!(fen_string, " {}", self.move_counter.fullmove_number)
|
||||
.map_err(ToFenStrError::FmtError)?;
|
||||
|
||||
Ok(fen_string)
|
||||
}
|
||||
|
@ -246,7 +248,7 @@ impl FromFenStr for Board {
|
|||
let half_move_clock: u16 = half_move_clock
|
||||
.parse()
|
||||
.map_err(FromFenStrError::ParseIntError)?;
|
||||
builder.ply_counter(half_move_clock);
|
||||
builder.halfmove_number(half_move_clock);
|
||||
|
||||
let full_move_counter = fields
|
||||
.next()
|
||||
|
@ -254,7 +256,7 @@ impl FromFenStr for Board {
|
|||
let full_move_counter: u16 = full_move_counter
|
||||
.parse()
|
||||
.map_err(FromFenStrError::ParseIntError)?;
|
||||
builder.move_number(full_move_counter);
|
||||
builder.fullmove_number(full_move_counter);
|
||||
|
||||
debug_assert_eq!(fields.next(), None);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue