Skip to content

Instantly share code, notes, and snippets.

@atoponce
Last active October 10, 2024 17:27
Show Gist options
  • Save atoponce/ed7ace2fdb36d0d00bb15d504ff880de to your computer and use it in GitHub Desktop.
Save atoponce/ed7ace2fdb36d0d00bb15d504ff880de to your computer and use it in GitHub Desktop.
> deck
[
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52
]
> shuffle.mongean(deck
[
52, 50, 48, 46, 44, 42, 40, 38, 36, 34, 32,
30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10,
8, 6, 4, 2, 1, 3, 5, 7, 9, 11, 13,
15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35,
37, 39, 41, 43, 45, 47, 49, 51
]
> shuffle.ouroboros(deck)
[
26, 27, 25, 28, 24, 29, 23, 30, 22, 31, 21,
32, 20, 33, 19, 34, 18, 35, 17, 36, 16, 37,
15, 38, 14, 39, 13, 40, 12, 41, 11, 42, 10,
43, 9, 44, 8, 45, 7, 46, 6, 47, 5, 48,
4, 49, 3, 50, 2, 51, 1, 52
]
> shuffle.reverse(deck)
[
52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42,
41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31,
30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20,
19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9,
8, 7, 6, 5, 4, 3, 2, 1
]
> shuffle.pile(deck)
[
49, 45, 41, 37, 33, 29, 25, 21, 17, 13, 9,
5, 1, 50, 46, 42, 38, 34, 30, 26, 22, 18,
14, 10, 6, 2, 51, 47, 43, 39, 35, 31, 27,
23, 19, 15, 11, 7, 3, 52, 48, 44, 40, 36,
32, 28, 24, 20, 16, 12, 8, 4
]
> shuffle.mexicanSpiral(deck)
[
1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21,
23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43,
45, 47, 49, 51, 2, 6, 10, 14, 18, 22, 26,
30, 34, 38, 42, 46, 50, 4, 12, 20, 28, 36,
44, 52, 16, 32, 48, 24, 8, 40
]
> shuffle.perfectIn(deck)
[
27, 1, 28, 2, 29, 3, 30, 4, 31, 5, 32,
6, 33, 7, 34, 8, 35, 9, 36, 10, 37, 11,
38, 12, 39, 13, 40, 14, 41, 15, 42, 16, 43,
17, 44, 18, 45, 19, 46, 20, 47, 21, 48, 22,
49, 23, 50, 24, 51, 25, 52, 26
]
> shuffle.perfectOut(deck)
[
1, 27, 2, 28, 3, 29, 4, 30, 5, 31, 6,
32, 7, 33, 8, 34, 9, 35, 10, 36, 11, 37,
12, 38, 13, 39, 14, 40, 15, 41, 16, 42, 17,
43, 18, 44, 19, 45, 20, 46, 21, 47, 22, 48,
23, 49, 24, 50, 25, 51, 26, 52
]
> shuffle.cut(deck, 17)
[
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 1, 2, 3, 4, 5, 6, 7, 8, 9,
10, 11, 12, 13, 14, 15, 16, 17
]
> shuffle.redBlack(deck)
[
1, 14, 2, 15, 3, 16, 4, 17, 5, 18, 6,
19, 7, 20, 8, 21, 9, 22, 10, 23, 11, 24,
12, 25, 13, 26, 40, 27, 41, 28, 42, 29, 43,
30, 44, 31, 45, 32, 46, 33, 47, 34, 48, 35,
49, 36, 50, 37, 51, 38, 52, 39
]
> shuffle.isUnshuffled(deck)
true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment