10-28-2003, 01:09 AM
I am working on a program that randomly picks one card, if the card is a diamond or heart it goes in stack1. If the card is a club or spade it goes in stack 2. Each stack can only hold 10 cards. Once one of the stack reaches 10 cards then it will not be able to deal anymore and it will print each stack to a text file. (stack1 to file1, stack2 to file2).
I have tried a lot of things and i just cant figure it out, I have recieved help and examples from the instructor but it hasnt helped.
Here is what i have so far:
I have tried a lot of things and i just cant figure it out, I have recieved help and examples from the instructor but it hasnt helped.
Here is what i have so far:
Code:
DIM numbs$(12)
numbs$(1) = "Ace of "
numbs$(2) = "2 of "
numbs$(3) = "3 of "
numbs$(4) = "4 of "
numbs$(5) = "5 of "
numbs$(6) = "6 of "
numbs$(7) = "7 of "
numbs$(8) = "8 of "
numbs$(9) = "9 of "
numbs$(10) = "Jack of "
numbs$(11) = "Queen of "
numbs$(12) = "King of "
DIM shape$(4)
shape$(1) = "Spades"
shape$(2) = "Diamonds"
shape$(3) = "Hearts"
shape$(4) = "Clubs"
RANDOMIZE TIMER
CLS
redo:
i% = INT(RND * 12) + 1
t% = INT(RND * 4) + 1
n$ = LTRIM$(RTRIM$(STR$(i%)))
IF INSTR(used$, n$) THEN GOTO redo
used$ = used$ + n$
IF t% = 2 THEN
COLOR 12
END IF
IF t% = 3 THEN
COLOR 12
END IF
IF t% = 1 THEN
COLOR 13
END IF
IF t% = 4 THEN
COLOR 13
END IF
PRINT numbs$(i%); shape$(t%)
COLOR 7
OPEN "rfile.txt" FOR OUTPUT AS #1
PRINT #1, numbs$(i%); shape$(t%)
CLOSE