The QBasic Forum      Other Subforums, Links and Downloads
 Return to Index  

My mini shuffle code...

February 2 2008 at 11:36 AM
Pete  (Login The-Universe)
Admin


Response to Deck of Cards: Shuffling and dealing hands

RANDOMIZE TIMER: CLS : REDIM card(52)
DO UNTIL noc = 52: x = INT(RND * 52)
FOR i = 1 TO noc: IF card(i) = x THEN EXIT FOR
NEXT
IF i > noc THEN
noc = noc + 1: card(noc) = x
IF CSRLIN > 13 THEN column = column + 20: LOCATE 1
LOCATE , column + 1
SELECT CASE x MOD 13
CASE 1 TO 9: PRINT LTRIM$(STR$(x MOD 13 + 1));
CASE 10: PRINT "J";
CASE 11: PRINT "Q";
CASE 12: PRINT "K";
CASE 0: PRINT "A";
END SELECT
PRINT CHR$(3 + x MOD 4)
END IF
LOOP

 
 Respond to this message   

Newbies usually go to www.qbasic.com and click on The QBasic Forum
Forum regulars have their own ways, which include The QBasic Community Forums