From f61573513cef0938124fa961a2a436bf532827b5 Mon Sep 17 00:00:00 2001 From: funman300 Date: Tue, 7 Jul 2026 11:01:25 -0700 Subject: [PATCH] fix(engine): remove latent unreachable! panic in difficulty seed cursor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Random arm was only unreachable because seeds_for(Random) returns None in a different function — a future catalog change would turn it into a shipped runtime panic. Returning a system-time seed is the correct Random behaviour either way. CLAUDE.md §2.3. Co-Authored-By: Claude Fable 5 --- solitaire_engine/src/difficulty_plugin.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/solitaire_engine/src/difficulty_plugin.rs b/solitaire_engine/src/difficulty_plugin.rs index fa21b57..33ae211 100644 --- a/solitaire_engine/src/difficulty_plugin.rs +++ b/solitaire_engine/src/difficulty_plugin.rs @@ -54,7 +54,10 @@ impl DifficultyIndexResource { DifficultyLevel::Hard => &mut self.hard, DifficultyLevel::Expert => &mut self.expert, DifficultyLevel::Grandmaster => &mut self.grandmaster, - DifficultyLevel::Random => unreachable!("Random has no catalog"), + // Random has no catalog today, so seeds_for() already returned + // None above; if it ever gains one, a time seed is still the + // right answer for "Random" — never a reachable panic. + DifficultyLevel::Random => return seed_from_system_time(), }; let seed = catalog[*cursor % catalog.len()]; *cursor = cursor.wrapping_add(1);