From e43041711a03b4785866955951611a57f65a5bf6 Mon Sep 17 00:00:00 2001 From: Rhys Lloyd Date: Fri, 29 May 2026 14:41:57 -0700 Subject: [PATCH] rename state to session --- card_game/src/lib.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/card_game/src/lib.rs b/card_game/src/lib.rs index 94e7736..bdfcf80 100644 --- a/card_game/src/lib.rs +++ b/card_game/src/lib.rs @@ -498,9 +498,9 @@ where /// Attempt to produce a solution. pub fn solve(&self) -> Result>, SolveError> { let mut state_moves = std::collections::HashMap::new(); - let mut state = self.clone(); + let mut session = self.clone(); let mut moves = 0; - while !state.is_win() { + while !session.is_win() { moves += 1; if self.config.solve_moves_budget < moves { return Err(SolveError::MovesBudgetExceeded); @@ -510,9 +510,9 @@ where } // Continue existing iterator if it exists let it = state_moves - .entry(state.state().state().clone()) + .entry(session.state().state().clone()) .or_insert_with(|| { - state + session .state() .state() .possible_instructions(&self.config().inner) @@ -520,19 +520,19 @@ where // Run one possible move if let Some(instruction) = it.next() { - state.process_instruction(instruction); + session.process_instruction(instruction); continue; } // No more moves. If we can't undo we're done - if state.history().is_empty() { + if session.history().is_empty() { return Ok(None); } else { - state.undo(); + session.undo(); } } Ok(Some(Solution { - solution: state.state.history, + solution: session.state.history, })) } }