-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add method to get side to move as number #33
Comments
there is already However, the most common case for this is to move a square forward. As a result, there are functions |
I know its niche, but IMO having to write let color = if board.side_to_move() == Color::White {
1
} else {
-1
}; (rustfmt forces it to be this way) Distracts from the business logic. I understand a reluctance to add such a small niche feature though, I can always extract the else-if to a helper function. |
Can you give me an example of where this may be used? A more ergonomic (and branchless) way to write this would be |
Oh yeah I'm an idiot, I'll use |
A common idiom in engines is something like this
It would be convenient if there was a method to get the number version of the side to move, perhaps a method on
Color
, such as(name is debatable, but this is the idea)
The text was updated successfully, but these errors were encountered: