Copyright | (c) Eric Mertens 2019 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
https://adventofcode.com/2019/day/22
>>>
let shuffleTest cmds = invert (techsToLinearFn cmds) `withModulus` 10 <$> [0..9]
>>>
shuffleTest [DealNew]
[9,8,7,6,5,4,3,2,1,0]
>>>
shuffleTest [Cut 3]
[3,4,5,6,7,8,9,0,1,2]
>>>
shuffleTest [Cut (-4)]
[6,7,8,9,0,1,2,3,4,5]
>>>
shuffleTest [DealInc 3]
[0,7,4,1,8,5,2,9,6,3]
>>>
shuffleTest [DealInc 7, DealNew, DealNew]
[0,3,6,9,2,5,8,1,4,7]
>>>
shuffleTest [Cut 6, DealInc 7, DealNew]
[3,0,7,4,1,8,5,2,9,6]
>>>
shuffleTest [DealInc 7, DealInc 9, Cut (-2)]
[6,3,0,7,4,1,8,5,2,9]
>>>
shuffleTest [DealNew, Cut (-2), DealInc 7, Cut 8, Cut (-4), DealInc 7, Cut 3, DealInc 9, DealInc 3, Cut (-1)]
[9,2,5,8,1,4,7,0,3,6]