home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1993 May / 1993-05.d64 / monroe (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  510b  |  20 lines

  1. 1 poke53280,6:poke53281,6:print"[147]"
  2. 5 print"[147]press any key to randomize 52 numbers
  3. 6 [153]"without repeats.":[153]
  4. 7 [161]a$:[139]a$[178]""[167]7
  5. 10 c[178]52:q[178][187]([171]ti[173]101)
  6. 20 [134]r(c),x(c)
  7. 25 [143] initialize the deck
  8. 30 [129]i[178]1[164]c:x(i)[178]i:[130]
  9. 35 [143] generate 52 random numbers between 1-52 incl. (not necessarily unique)
  10. 40 [129]i[178]1[164]c:r(i)[178][181](c[172][187](1))[170]1:[130]i
  11. 45 [143] generate the random permutation
  12. 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
  13. 60 [129]i[178]1[164]c
  14. 70 [153]x(i),
  15. 80 [130]i
  16. 90 [153]:[153]:[153]"again? (y=yes, n=no)":[153]
  17. 100 [161]a$:[139]a$[179][177]"y"[167][139]a$[179][177]"n"[167]100
  18. 110 [139]a$[178]"n"[167][128]
  19. 120 [137]40
  20.