try tableau moves first in KlondikeIter

This commit is contained in:
2026-05-15 10:43:07 -07:00
parent a8d9798001
commit 31025964ef
+6 -6
View File
@@ -11,7 +11,6 @@ impl Default for KlondikeConfig {
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub enum KlondikePileId { pub enum KlondikePileId {
Stock,
Tableau0, Tableau0,
Tableau1, Tableau1,
Tableau2, Tableau2,
@@ -24,12 +23,12 @@ pub enum KlondikePileId {
Foundation1, Foundation1,
Foundation2, Foundation2,
Foundation3, Foundation3,
Stock,
} }
impl KlondikePileId { impl KlondikePileId {
fn next(self) -> Option<Self> { fn next(self) -> Option<Self> {
use KlondikePileId::*; use KlondikePileId::*;
Some(match self { Some(match self {
Stock => Tableau0,
Tableau0 => Tableau1, Tableau0 => Tableau1,
Tableau1 => Tableau2, Tableau1 => Tableau2,
Tableau2 => Tableau3, Tableau2 => Tableau3,
@@ -41,7 +40,8 @@ impl KlondikePileId {
Foundation0 => Foundation1, Foundation0 => Foundation1,
Foundation1 => Foundation2, Foundation1 => Foundation2,
Foundation2 => Foundation3, Foundation2 => Foundation3,
Foundation3 => return None, Foundation3 => Stock,
Stock => return None,
}) })
} }
} }
@@ -148,8 +148,8 @@ impl KlondikeIter {
fn new() -> Self { fn new() -> Self {
Self { Self {
instruction: Some(KlondikeInstruction { instruction: Some(KlondikeInstruction {
src: KlondikePileId::Stock, src: KlondikePileId::Tableau0,
dst: KlondikePileId::Stock, dst: KlondikePileId::Tableau1,
}), }),
} }
} }
@@ -192,7 +192,6 @@ impl Klondike {
let state = KlondikeState { let state = KlondikeState {
piles: [ piles: [
stock,
t0, t0,
t1, t1,
t2, t2,
@@ -205,6 +204,7 @@ impl Klondike {
Pile::new(), Pile::new(),
Pile::new(), Pile::new(),
Pile::new(), Pile::new(),
stock,
], ],
}; };
Self { config, state } Self { config, state }