home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1993-08-02 | 884 b | 37 lines |
- ' This programs shuffles and generates a deck of cards using strings only
- Screen Open 0,640,256,2,Hires : Colour 1,$FFF
- Dim C$(52),CO(52)
- Global C$(),CO()
- SETUP
- _RANDOM[52,52]
- For X=1 To 52 : Print X;" ";C$(CO(X)) : Next X
- Procedure SETUP
- Z=1 : Dim CD$(4)
- CD$(1)=" Of Hearts"
- CD$(2)=" Of Diamonds"
- CD$(3)=" Of Clubs"
- CD$(4)=" Of Spades"
- For C=1 To 4
- C$(Z)="ACE"+CD$(C) : Inc Z
- For X=2 To 10
- C$(Z)=Str$(X)-" "+CD$(C) : Inc Z
- Next X
- C$(Z)="Jack"+CD$(C) : Inc Z
- C$(Z)="Queen"+CD$(C) : Inc Z
- C$(Z)="King"+CD$(C) : Inc Z
- Next C
- End Proc
- Procedure _RANDOM[HN,NRN]
- If NRN>HN Then Pop Proc
- Randomize Timer
- Z=1
- Repeat
- L:
- RN=Rnd(HN) : If RN=0 Then Goto L
- If Z=1 Then CO(Z)=RN : Inc Z
- For X=1 To Z
- If RN=CO(X) Then Goto L
- Next X
- CO(Z)=RN : Inc Z
- Until Z=NRN+1
- End Proc