24 lines
641 B
Rust
24 lines
641 B
Rust
use crate::game::{ActionKind, Choice, Spot};
|
|
|
|
/// The cheapest way to stay in the hand: check when free, else call.
|
|
pub fn cheapest_continue(spot: &Spot) -> Option<Choice> {
|
|
if spot.is_legal(ActionKind::Check) {
|
|
Some(Choice::Check)
|
|
} else if spot.is_legal(ActionKind::Call) {
|
|
Some(Choice::Call)
|
|
} else {
|
|
None
|
|
}
|
|
}
|
|
|
|
/// The way to give up: check when that is free, else fold.
|
|
pub fn give_up(spot: &Spot) -> Option<Choice> {
|
|
if spot.is_legal(ActionKind::Check) {
|
|
Some(Choice::Check)
|
|
} else if spot.is_legal(ActionKind::Fold) {
|
|
Some(Choice::Fold)
|
|
} else {
|
|
None
|
|
}
|
|
}
|