#[non_exhaustive]pub struct HeuristicConfig {
pub knock_threshold: u8,
pub safety_weight: u8,
pub score_awareness: u8,
}Expand description
Tuning knobs for HeuristicBot
Like gin_rummy::Rules, the struct is non-exhaustive: start from
HeuristicConfig::default and adjust fields.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.knock_threshold: u8Knock whenever the residual deadwood is at most
min(knock_limit, knock_threshold)
The default of 4 holds out past the first legal knock — banking a
small knock every hand loses a game to the gin and undercut bonuses.
Raise it toward the knock limit to knock as soon as the rules allow,
or lower it to hunt gin. score_awareness
bends this threshold by the game score at play time.
safety_weight: u8Weight of discard safety against the opponent’s revealed cards
Zero ignores the opponent entirely, reproducing the pure greedy player. The default is 1.
score_awareness: u8How strongly the game score shifts the knock threshold
Points of threshold shift per unit of margin / (game_target − leader_score), where margin is this seat’s game-score lead and
leader_score the higher of the two running totals. Ahead the
effective threshold rises toward the
legal limit (bank the lead by knocking early); behind it falls
toward zero (hold out for a gin that swings the deficit). The
denominator is the leader’s distance to the winning line, not the
full target, so the same lead bends the threshold ever harder as
the game nears its end: a modest early-game nudge becomes a knock
at any deadwood once the front-runner is a hand from winning. Zero
ignores the score, so a round played outside a game is unaffected.
Trait Implementations§
Source§impl Clone for HeuristicConfig
impl Clone for HeuristicConfig
Source§fn clone(&self) -> HeuristicConfig
fn clone(&self) -> HeuristicConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for HeuristicConfig
Source§impl Debug for HeuristicConfig
impl Debug for HeuristicConfig
Source§impl Default for HeuristicConfig
impl Default for HeuristicConfig
impl Eq for HeuristicConfig
Source§impl PartialEq for HeuristicConfig
impl PartialEq for HeuristicConfig
impl StructuralPartialEq for HeuristicConfig
Auto Trait Implementations§
impl Freeze for HeuristicConfig
impl RefUnwindSafe for HeuristicConfig
impl Send for HeuristicConfig
impl Sync for HeuristicConfig
impl Unpin for HeuristicConfig
impl UnsafeUnpin for HeuristicConfig
impl UnwindSafe for HeuristicConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more