1
0
Fork 0

new square constructors

This commit is contained in:
Paul-Nicolas Madelaine 2025-11-05 23:37:02 +01:00
parent de321719f4
commit ad1c4c57ad
7 changed files with 59 additions and 44 deletions

View file

@ -81,8 +81,8 @@ impl UciMove {
pub fn from_ascii(s: &[u8]) -> Option<Self> {
match s {
[a, b, c, d, s @ ..] => Some(Self {
from: Square::new(File::from_ascii(*a)?, Rank::from_ascii(*b)?),
to: Square::new(File::from_ascii(*c)?, Rank::from_ascii(*d)?),
from: Square::from_coords(File::from_ascii(*a)?, Rank::from_ascii(*b)?),
to: Square::from_coords(File::from_ascii(*c)?, Rank::from_ascii(*d)?),
promotion: match s {
[] => None,
[c] => Some(Role::from_ascii(*c)?),