Skip to content

Commit

Permalink
code golf
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed Dec 30, 2024
1 parent 49abfee commit f800254
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -846,9 +846,7 @@ impl<T: TableTag, S: Position + Syzygy> Table<T, S> {
};

let magic_header = read_magic_header(&*raf)?;
if magic != magic_header
&& (material.has_pawns() || pawnless_magic.map_or(true, |m| m != magic_header))
{
if magic != magic_header && (material.has_pawns() || pawnless_magic != Some(magic_header)) {
return Err(ProbeError::Magic {
magic: magic_header,
});
Expand Down
4 changes: 2 additions & 2 deletions src/tablebase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ impl<S: Position + Clone + Syzygy> Tablebase<S> {
return Err(io::Error::from(io::ErrorKind::InvalidInput));
};
let is_tbw = ext == S::TBW.ext
|| (!material.has_pawns() && S::PAWNLESS_TBW.map_or(false, |t| ext == t.ext));
|| (!material.has_pawns() && S::PAWNLESS_TBW.is_some_and(|t| ext == t.ext));
let is_tbz = ext == S::TBZ.ext
|| (!material.has_pawns() && S::PAWNLESS_TBZ.map_or(false, |t| ext == t.ext));
|| (!material.has_pawns() && S::PAWNLESS_TBZ.is_some_and(|t| ext == t.ext));
if !is_tbw && !is_tbz {
return Err(io::Error::from(io::ErrorKind::InvalidInput));
}
Expand Down

0 comments on commit f800254

Please sign in to comment.