Deal cards for FreeCell: Difference between revisions

J: rephrase to more closely match task description
No edit summary
(J: rephrase to more closely match task description)
Line 107:
Paraphrase of C:
 
<lang j>deck=: ,/ 'KQJT98765432AA23456789TJQK' ,"0/ 7 u: '♠♥♦♣♣♦♥♠'
 
seed=: do bind 'SEED'
srnd=: 3 :'SEED=:{.y,11982'
srnd ''
seed=: do bind 'SEED'
rnd=: (2^16) <.@%~ (2^31) srnd@| 2531011 + 214013 * seed
 
pairs=: i. <@<@~."1@,. (<: - ], (| rnd))@- >:@i.@-@# NB. indices to swap, for shuffle
swaps=: [: > C.&.>/@|.@; NB. implement the specified shuffle
deal=: |.@(swaps pairs@#) bind deck
 
show=: (,"2)@:(_8 ]\ ' '&,.)</lang>
6,962

edits