home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1993 May
/
1993-05.d64
/
monroe
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
510b
|
20 lines
1 poke53280,6:poke53281,6:print"[147]"
5 print"[147]press any key to randomize 52 numbers
6 [153]"without repeats.":[153]
7 [161]a$:[139]a$[178]""[167]7
10 c[178]52:q[178][187]([171]ti[173]101)
20 [134]r(c),x(c)
25 [143] initialize the deck
30 [129]i[178]1[164]c:x(i)[178]i:[130]
35 [143] generate 52 random numbers between 1-52 incl. (not necessarily unique)
40 [129]i[178]1[164]c:r(i)[178][181](c[172][187](1))[170]1:[130]i
45 [143] generate the random permutation
50 [129]i[178]1[164]c:a[178]r(i):b[178]x(i):x(i)[178]x(a):x(a)[178]b:[130]i
60 [129]i[178]1[164]c
70 [153]x(i),
80 [130]i
90 [153]:[153]:[153]"again? (y=yes, n=no)":[153]
100 [161]a$:[139]a$[179][177]"y"[167][139]a$[179][177]"n"[167]100
110 [139]a$[178]"n"[167][128]
120 [137]40