Skip to main content

HeuristicConfig

Struct HeuristicConfig 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§knock_threshold: u8

Knock 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: u8

Weight 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: u8

How 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

Source§

fn clone(&self) -> HeuristicConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for HeuristicConfig

Source§

impl Debug for HeuristicConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HeuristicConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for HeuristicConfig

Source§

impl PartialEq for HeuristicConfig

Source§

fn eq(&self, other: &HeuristicConfig) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for HeuristicConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.