api/gameserv: type email ExpiryTarget and chess Ending as enums (drop stringly returns)
All checks were successful
CI / check (push) Successful in 3m53s
All checks were successful
CI / check (push) Successful in 3m53s
This commit is contained in:
parent
2cdc7f820a
commit
f5c976eb56
4 changed files with 43 additions and 20 deletions
|
|
@ -289,11 +289,10 @@ pub fn terminal(g: &Game) -> Option<Outcome> {
|
|||
}
|
||||
full_or_ongoing(b)
|
||||
}
|
||||
Board::Chess(st) => match chess::over(st).as_str() {
|
||||
"w" => Some(Outcome::Win(Side::A)),
|
||||
"b" => Some(Outcome::Win(Side::B)),
|
||||
"draw" => Some(Outcome::Draw),
|
||||
_ => None,
|
||||
Board::Chess(st) => match chess::over(st) {
|
||||
None => None,
|
||||
Some(chess::Ending::Draw) => Some(Outcome::Draw),
|
||||
Some(chess::Ending::Checkmate(c)) => Some(Outcome::Win(if c == b'w' { Side::A } else { Side::B })),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue