Skip to content

Commit

Permalink
into_flipped -> into_swapped
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed Dec 29, 2024
1 parent 6a65560 commit f337289
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ harness = false
[dependencies]
arrayvec = "0.7"
bitflags = "2"
shakmaty = "0.27"
shakmaty = "0.27.2"
byteorder = "1.2"
rustc-hash = "2"
once_cell = "1.12"
Expand Down
4 changes: 2 additions & 2 deletions src/material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ impl Material {
.unwrap_or(0)
}

pub(crate) fn into_flipped(self) -> Material {
pub(crate) fn into_swapped(self) -> Material {
Material {
by_color: self.by_color.into_flipped(),
by_color: self.by_color.into_swapped(),
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ impl<T: TableTag, S: Position + Syzygy> Table<T, S> {
.map(|side| {
let pieces = parse_pieces(&*raf, ptr, material.count(), *side)?;
let key = Material::from_iter(pieces.clone());
ensure!(key == material || key.into_flipped() == material);
ensure!(key == material || key.into_swapped() == material);
GroupData::new::<S>(pieces, order[side.fold_wb(0, 1)], file)
})
.collect::<ProbeResult<ArrayVec<_, 2>>>()?;
Expand Down Expand Up @@ -1132,7 +1132,7 @@ impl<T: TableTag, S: Position + Syzygy> Table<T, S> {
fn encode(&self, pos: &S) -> ProbeResult<Option<(&PairsData, u64)>> {
let key = Material::from_board(pos.board());
let material = Material::from_iter(self.files[0].sides[0].groups.pieces.clone());
assert!(key == material || key == material.clone().into_flipped());
assert!(key == material || key == material.clone().into_swapped());

let symmetric_btm = material.is_symmetric() && pos.turn().is_black();
let black_stronger = key != material;
Expand Down
4 changes: 2 additions & 2 deletions src/tablebase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ impl<S: Position + Clone + Syzygy> Tablebase<S> {
if let Some((path, table)) = self
.wdl
.get(key)
.or_else(|| self.wdl.get(&key.clone().into_flipped()))
.or_else(|| self.wdl.get(&key.clone().into_swapped()))
{
table
.get_or_try_init(|| WdlTable::new(self.filesystem.open(path)?, key))
Expand All @@ -236,7 +236,7 @@ impl<S: Position + Clone + Syzygy> Tablebase<S> {
if let Some((path, table)) = self
.dtz
.get(key)
.or_else(|| self.dtz.get(&key.clone().into_flipped()))
.or_else(|| self.dtz.get(&key.clone().into_swapped()))
{
table
.get_or_try_init(|| DtzTable::new(self.filesystem.open(path)?, key))
Expand Down

0 comments on commit f337289

Please sign in to comment.