previous
|
index
|
next
Shuffle Problem Approach
Let a deck be represented by
(1 2 3 ... 52)
.
Use
integers-from-to
to create the deck.
Use
first-elements-of
and
list-tail
to create the halves
(1 2 3 ... 26)
and
(27 28 29 ... 52)
.
Use a procedure
interleave
to interleave the two halves:
(interleave (1 2 3 ... 26)
(27 28 29 ... 52)
) ⇒ (1
27
2
28
3
29
... 26
52
)
Check if the result is
(1 2 3 ... 52)
.
If not, repeat step 3 on the result.
previous
|
index
|
next