chore(core): delete deck.rs and scoring.rs
Build and Deploy / build-and-push (push) Failing after 1m18s
Build and Deploy / build-and-push (push) Failing after 1m18s
- deck.rs (193 lines) — Deck/deal_klondike replaced by Klondike::with_seed() - scoring.rs (152 lines) — scoring fns superseded by KlondikeAdapter; move compute_time_bonus to klondike_adapter.rs, update win_summary_plugin import - Remove rand dep from solitaire_core (only used by deck.rs) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -237,8 +237,7 @@ pub fn card_to_kl(card: &crate::card::Card) -> KlCard {
|
||||
/// Convert a [`card_game::Card`] back to our [`crate::card::Card`], assigning
|
||||
/// a stable `id` derived from the suit and rank (0–51, Clubs-first ordering).
|
||||
///
|
||||
/// This id matches the id assigned in [`crate::deck::Deck::new`] and is
|
||||
/// consistent for the same logical card across all reconstructions.
|
||||
/// The id is consistent for the same logical card across all reconstructions.
|
||||
pub fn card_from_kl(card: &KlCard) -> crate::card::Card {
|
||||
let suit = suit_from_kl(card.suit());
|
||||
let rank = rank_from_kl(card.rank());
|
||||
@@ -518,3 +517,12 @@ impl TryFrom<SavedInstruction> for KlondikeInstruction {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// Time bonus added to the score on a win: `700_000 / elapsed_seconds`.
|
||||
/// Returns 0 when `elapsed_seconds` is 0 to avoid division by zero.
|
||||
pub fn compute_time_bonus(elapsed_seconds: u64) -> i32 {
|
||||
if elapsed_seconds == 0 {
|
||||
return 0;
|
||||
}
|
||||
(700_000u64 / elapsed_seconds).min(i32::MAX as u64) as i32
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user