Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :- %say
- |= [[* eny=@uvJ *] [x=@ud y=@ud ~] ~]
- :- %noun
- =< (deal x y)
- |%
- ++ deck
- |.
- ^- (list [@t @t])
- =/ r=(list @t) ~['2' '3' '4' '5' '6' '7' '8' '9' '10' 'J' 'Q' 'K' 'A']
- =/ s=(list @t) ~['♥' '♣' '♦' '♠']
- =| acc=(list [@t @t])
- |- ^- (list [@t @t])
- ?~ s acc
- %= $
- s t.s
- acc |- ?~ r acc
- $(r t.r, acc [[i.r i.s] acc])
- ==
- ++ shuffle
- |= x=(list [@t @t])
- ^- (list [@t @t])
- =| acc=(list [@t @t])
- =+ rng=~(. og eny)
- |- ^- (list [@t @t])
- ?~ x acc
- =/ r (rads:rng (lent x))
- =/ v=[@t @t] (snag -:r `(list [@t @t])`x)
- =/ t=(list [@t @t]) (oust [-:r 1] `(list [@t @t])`x)
- $(acc [v acc], x t, rng +:r)
- ++ deal
- |= [x=@ud y=@ud]
- ^- (list (list [@t @t]))
- =/ r=(list [@t @t]) (shuffle (deck))
- =| acc=(list (list [@t @t]))
- |- ^- (list (list [@t @t]))
- ?: =(x 0) acc $(x (dec x), r (slag y r), acc [(scag y r) acc])
- --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement