fix tableaus
This commit is contained in:
+3
-6
@@ -18,7 +18,6 @@ pub enum KlondikePileId {
|
|||||||
Tableau5,
|
Tableau5,
|
||||||
Tableau6,
|
Tableau6,
|
||||||
Tableau7,
|
Tableau7,
|
||||||
Tableau8,
|
|
||||||
Foundation1,
|
Foundation1,
|
||||||
Foundation2,
|
Foundation2,
|
||||||
Foundation3,
|
Foundation3,
|
||||||
@@ -35,8 +34,7 @@ impl KlondikePileId {
|
|||||||
Tableau4 => Tableau5,
|
Tableau4 => Tableau5,
|
||||||
Tableau5 => Tableau6,
|
Tableau5 => Tableau6,
|
||||||
Tableau6 => Tableau7,
|
Tableau6 => Tableau7,
|
||||||
Tableau7 => Tableau8,
|
Tableau7 => Foundation1,
|
||||||
Tableau8 => Foundation1,
|
|
||||||
Foundation1 => Foundation2,
|
Foundation1 => Foundation2,
|
||||||
Foundation2 => Foundation3,
|
Foundation2 => Foundation3,
|
||||||
Foundation3 => Foundation4,
|
Foundation3 => Foundation4,
|
||||||
@@ -75,7 +73,7 @@ impl KlondikeInstruction {
|
|||||||
|
|
||||||
const STOCKS: usize = 1;
|
const STOCKS: usize = 1;
|
||||||
const FOUNDATIONS: usize = 4;
|
const FOUNDATIONS: usize = 4;
|
||||||
const TABLEAUS: usize = 8;
|
const TABLEAUS: usize = 7;
|
||||||
const fn sum(n: usize) -> usize {
|
const fn sum(n: usize) -> usize {
|
||||||
n * (n + 1) / 2
|
n * (n + 1) / 2
|
||||||
}
|
}
|
||||||
@@ -198,7 +196,7 @@ impl Klondike {
|
|||||||
let mut deck = deck.into_iter();
|
let mut deck = deck.into_iter();
|
||||||
|
|
||||||
// generate tableaus
|
// generate tableaus
|
||||||
let [t0, t1, t2, t3, t4, t5, t6, t7] = core::array::from_fn(|i| {
|
let [t0, t1, t2, t3, t4, t5, t6] = core::array::from_fn(|i| {
|
||||||
let stack = arrayvec::ArrayVec::from_iter((&mut deck).take(i)).into();
|
let stack = arrayvec::ArrayVec::from_iter((&mut deck).take(i)).into();
|
||||||
let mut pile = Pile::new_face_down(stack);
|
let mut pile = Pile::new_face_down(stack);
|
||||||
pile.push(deck.next().unwrap());
|
pile.push(deck.next().unwrap());
|
||||||
@@ -217,7 +215,6 @@ impl Klondike {
|
|||||||
t4,
|
t4,
|
||||||
t5,
|
t5,
|
||||||
t6,
|
t6,
|
||||||
t7,
|
|
||||||
Pile::new(),
|
Pile::new(),
|
||||||
Pile::new(),
|
Pile::new(),
|
||||||
Pile::new(),
|
Pile::new(),
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ impl Display for Klondike {
|
|||||||
KlondikePileId::Tableau5,
|
KlondikePileId::Tableau5,
|
||||||
KlondikePileId::Tableau6,
|
KlondikePileId::Tableau6,
|
||||||
KlondikePileId::Tableau7,
|
KlondikePileId::Tableau7,
|
||||||
KlondikePileId::Tableau8,
|
|
||||||
]
|
]
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
@@ -108,7 +107,6 @@ impl core::str::FromStr for Parsed<KlondikePileId> {
|
|||||||
"T5" | "t5" => KlondikePileId::Tableau5,
|
"T5" | "t5" => KlondikePileId::Tableau5,
|
||||||
"T6" | "t6" => KlondikePileId::Tableau6,
|
"T6" | "t6" => KlondikePileId::Tableau6,
|
||||||
"T7" | "t7" => KlondikePileId::Tableau7,
|
"T7" | "t7" => KlondikePileId::Tableau7,
|
||||||
"T8" | "t8" => KlondikePileId::Tableau8,
|
|
||||||
"F1" | "f1" => KlondikePileId::Foundation1,
|
"F1" | "f1" => KlondikePileId::Foundation1,
|
||||||
"F2" | "f2" => KlondikePileId::Foundation2,
|
"F2" | "f2" => KlondikePileId::Foundation2,
|
||||||
"F3" | "f3" => KlondikePileId::Foundation3,
|
"F3" | "f3" => KlondikePileId::Foundation3,
|
||||||
|
|||||||
Reference in New Issue
Block a user