aboutsummaryrefslogtreecommitdiff
path: root/src/square.rs
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-01-30 22:35:14 +0300
committereug-vs <eugene@eug-vs.xyz>2023-01-30 22:36:08 +0300
commit46fd45da0ebd90a0c1bfeb3c4df5ea0f62601b1d (patch)
tree22b641a7384cdf372649c4c58d08ef04dd7a54da /src/square.rs
parent7849b36891ccf709a11f311c5bb84cb1466b991a (diff)
downloadchessnost-46fd45da0ebd90a0c1bfeb3c4df5ea0f62601b1d.tar.gz
feat: implement piece-square tables99-accuracy
Diffstat (limited to 'src/square.rs')
-rw-r--r--src/square.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/square.rs b/src/square.rs
index e518a92..2e47bea 100644
--- a/src/square.rs
+++ b/src/square.rs
@@ -81,6 +81,14 @@ impl Square {
Ok(Self::from_coords(rank as u8, file))
}
+
+ /// Returns the square on the mirrored board,
+ /// e.g E4 becomes E5, G2 becomes G7
+ pub fn mirror(&self) -> Self {
+ let rank = self.rank();
+ let file = self.file();
+ Self::from_coords(7 - rank, file)
+ }
}