dbravender / tricksterstable-rs

Rust implementations of game engines featured in Trickster's Table
Other
4 stars 0 forks source link

Voids immediately forgotten by the AI #4

Closed dbravender closed 4 months ago

dbravender commented 5 months ago

I noticed this when working on Hotdog using Yokai2p as a base (since both have straw piles).

    #[serde(skip)]
    pub voids: [HashSet<Suit>; 2],

I must have done this during the comparison against the old engine without realizing this would cause the AI to lose track of its opponent's voids. The backend is stateless so it must receive the entire game state with each update. Not receiving the voids means the AI never knows its opponents voids which will lead to very strange plays.

Goal: remove #[serde(skip)] here so the frontend can receive and pass back the current voids.

Maybe custom serialize_with and deserialize_with implementations will solve this. If that can't be done perhaps just using a Vec<Suit> here and making sure to not add duplicates will also solve the problem (albeit less efficiently).