chore(core): remove dead card_to_kl / suit_to_kl / rank_to_kl helpers
Build and Deploy / build-and-push (push) Failing after 56s

These were scaffolded for a future KlondikeState::from_piles() path
that never materialised. card_from_kl (used by sync_piles_from_session)
is retained; suit_from_kl / rank_from_kl are narrowed to pub(crate).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
funman300
2026-05-29 18:11:54 -07:00
parent 389fdd1fb0
commit 258abd198e
+4 -33
View File
@@ -13,7 +13,7 @@
//! - Move validation via klondike's rule engine (step 2).
//! - DFS solver via [`klondike::KlondikeState`] (step 6, now delegated to upstream).
use card_game::{Card as KlCard, Deck as KlDeck, Rank as KlRank, Suit as KlSuit};
use card_game::{Card as KlCard, Rank as KlRank, Suit as KlSuit};
use klondike::{
DrawStockConfig, DstFoundation, DstTableau, Foundation, KlondikeConfig, KlondikeInstruction,
KlondikePile, KlondikePileStack, MoveFromFoundationConfig, ScoringConfig, SkipCards, Tableau,
@@ -185,26 +185,10 @@ impl KlondikeAdapter {
}
}
// ── Type-conversion utilities (Step 2 — pile mapping) ────────────────────
//
// These are used to translate between solitaire_core's Card/PileType and the
// card_game / klondike types when projecting KlondikeState into the pile
// snapshot that the engine reads. A live KlondikeState shadow requires an
// upstream `KlondikeState::from_piles()` constructor; these utilities are
// ready to wire in once that's available.
/// Convert our [`crate::card::Suit`] to [`card_game::Suit`].
pub fn suit_to_kl(suit: crate::card::Suit) -> KlSuit {
match suit {
crate::card::Suit::Clubs => KlSuit::Clubs,
crate::card::Suit::Diamonds => KlSuit::Diamonds,
crate::card::Suit::Hearts => KlSuit::Hearts,
crate::card::Suit::Spades => KlSuit::Spades,
}
}
// ── Type-conversion utilities ─────────────────────────────────────────────
/// Convert [`card_game::Suit`] back to our [`crate::card::Suit`].
pub fn suit_from_kl(suit: KlSuit) -> crate::card::Suit {
pub(crate) fn suit_from_kl(suit: KlSuit) -> crate::card::Suit {
match suit {
KlSuit::Clubs => crate::card::Suit::Clubs,
KlSuit::Diamonds => crate::card::Suit::Diamonds,
@@ -213,27 +197,14 @@ pub fn suit_from_kl(suit: KlSuit) -> crate::card::Suit {
}
}
/// Convert our [`crate::card::Rank`] to [`card_game::Rank`].
pub fn rank_to_kl(rank: crate::card::Rank) -> KlRank {
KlRank::new(rank.value()).expect("rank value 1-13 always maps to a valid KlRank")
}
/// Convert [`card_game::Rank`] back to our [`crate::card::Rank`].
pub fn rank_from_kl(rank: KlRank) -> crate::card::Rank {
pub(crate) fn rank_from_kl(rank: KlRank) -> crate::card::Rank {
crate::card::Rank::RANKS
.into_iter()
.find(|r| r.value() == rank as u8)
.expect("KlRank 1-13 always maps to a valid Rank")
}
/// Convert our [`crate::card::Card`] to a [`card_game::Card`] (Deck1, same suit/rank).
///
/// The `id` field is dropped; use [`card_to_kl`] only when the klondike engine
/// needs to evaluate the card's logical identity, not its animation entity.
pub fn card_to_kl(card: &crate::card::Card) -> KlCard {
KlCard::new(KlDeck::Deck1, suit_to_kl(card.suit), rank_to_kl(card.rank))
}
/// Convert a [`card_game::Card`] back to our [`crate::card::Card`], assigning
/// a stable `id` derived from the suit and rank (051, Clubs-first ordering).
///