Anonymous user
Deal cards for FreeCell: Difference between revisions
→{{header|Python}}: Modified code to run with both python2 and python3
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
(→{{header|Python}}: Modified code to run with both python2 and python3) |
||
Line 2,739:
=={{header|Python}}==
{{trans|D}}
<lang python>
def randomGenerator(seed=1):
Line 2,751:
def deal(seed):
nc = 52
cards = list(range(nc - 1, -1, -1))
rnd = randomGenerator(seed)
for i, r in zip(range(nc), rnd):
Line 2,759:
def show(cards):
l = ["A23456789TJQK"[int(c
for i in range(0, len(cards), 8):
print
if __name__ == '__main__':
from sys import argv
seed = int(argv[1]) if len(argv) == 2 else 11982
print
deck = deal(seed)
show(deck)</lang>
{{out}}
<pre>Hand 11982
=={{header|Racket}}==
|