__________________________________________________________________ Title: Cards Version: 1.1 Author: Maverick - 106053.2370@compuserve.com Size: Approx. 1000 bytes Model: 7700 plus. Description: Program to draw a card on screen. Also separates a card given as a number from 1 to 52 into a suit and a card from 1 to 13. Needs NUMBERS, by Kim Hedin __________________________________________________________________ INPUT VARIABLES U=X-Co-ordinate, V=Y-Co-ordinate. C=Card, from 1 to 52. K=Display mode - 1 for off, 0 for on. COMMAND TRANSLATION _ 'display' (SHIFT, 7, F5) <> 'not equal to' (SHIFT, 7, F2, F2) <= 'less than or equal to'(SHIFT, 7, F2, F6) >= 'more than or equal to'(SHIFT, 7, F2, F5) -> 'put in to' => 'then' (SHIFT, 7, F1, F1) Ran# gives a random number. (SHIFT, 5, F2, F4) / divide r Small r variable (ALPHA,Graph) @ Theta variable (ALPHA,Range) ___________________________________________________________________ CaS Compatible PROGRAM Prog C 'Cards 1->S : C->r ; 1.r stores the Card no. Lbl 0 C>13 => Isz S C>13 => C-13->C C>13 => Goto 0 K=1 => Goto 9 ; 2.To find suit and card no, Plot U,V : Plot U+13,V ; but not display card, Line : Plot U+13,V+20 ; set K to 1 before running. Line : Plot U,V+20 Line : Plot U,V Line : U+3->W V+7->T Prog D ; 3.D can be any program V->T : U->R ; letter or number.... V+2->W : U+2->V ; 4.V,W and N are NUMBERS C->N ; variables C<>1 => C<11 => Prog N ; 5.Numbers - Prog N C>10 => Prog E C=1 => Prog E T+14->W : R+9->V C=10 => R+5->V C<>1 => C<11 => Prog N C>10 => Prog E C=1 => Prog E T->V : R->U ; 6.V and U are restored Lbl 9 Prog D 'Cdraw Suits S=1 => Goto 1 S=2 => Goto 2 S=3 => Goto 3 S=4 => Goto 4 Lbl 1 Plot W+3.5,T Plot W+5,T+3 : Line Plot W+3.5,T+6 : Line Plot W+2,T+3 : Line Plot W+3.5,T : Line Goto 0 Lbl 2 Plot W+3.5,T Plot W+6,T+3 : Line Plot W+6,T+4 : Line Plot W+5,T+5 : Line Plot W+4,T+5 : Line Plot W+3.5,T+4 : Line Plot W+3,T+5 : Line Plot W+2,T+5 : Line Plot W+1,T+4 : Line Plot W+1,T+3 : Line Plot W+3.5,T : Line Goto 0 Lbl 3 Plot W+3.5,T Plot W+3.5,T+2 : Line Plot W+3,T+1 : Line Plot W+2,T+1 : Line Plot W+1,T+2 : Line Plot W+1,T+3 : Line Plot W+3.5,T+6 : Line Plot W+6,T+3 : Line Plot W+6,T+2 : Line Plot W+5,T+1 : Line Plot W+4,T+1 : Line Plot W+3.5,T+2 : Line Goto 0 Lbl 4 Plot W+3.5,T Plot W+3.5,T+1 : Line Plot W+2.5,T+.5 : Line Plot W+1,T+2 : Line Plot W+2,T+3 : Line Plot W+3,T+3 : Line Plot W+2,T+4 : Line Plot W+3.5,T+5.5 : Line Plot W+5,T+4 : Line Plot W+4,T+3 : Line Plot W+5,T+3 : Line Plot W+6,T+2 : Line Plot W+4.5,T+.5: Line Plot W+3.5,T+1 : Line Lbl 0 Prog E 'Cdraw Letters C=11 => Goto 1 C=12 => Goto 2 C=13 => Goto 3 C=1 => Goto 4 Lbl 1 Plot V,W : Plot V+.5,W Line : Plot V+1,W+1 Line : Plot V+1,W+4 Line: Plot V,W+4 Plot V+2,W+4 : Line Goto 0 Lbl 2 Plot V,W : Plot V,W+4 Line : Plot V+2,W+4 Line : Plot V+2,W+1 Line : Plot V+1,W Line : Plot V,W Line : Plot V+1,W+1 Plot V+2,W : Line Goto 0 Lbl 3 Plot V,W : Plot V,W+4 Line : Plot V+2,W+4 Plot V,W+2 : Line Plot V+2,W : Line Goto 0 Lbl 4 Plot V,W : Plot V,W+4 Line : Plot V+2,W+4 Line : Plot V+2,W Line : Plot V,W+2 Plot V+2,W+2 : Line Lbl 0 __________________________________________________________________ What you end up with is: r as a card number, from 1 to 52. C as a card number from 1 to 13 (A=1,2=2,...,Q=12,K=13) S as a suit from 1 to 4 (1=Diamonds,2=Hearts,3=Spades,4=Clubs) Any problems with the program, send me an email at: Maverick - 106053.2370@compuserve.com Can anyone make a shorter code? This program can be used in any card game you wish to use. __________________________________________________________________