3 Card Game

1 reply [Last post]
italianapple's picture
Offline
Joined: Jan 28 2007
Posts: 94

My last Apple Basic program: Find the Queen:

I have tested it on my A-One Replica.

P.S. it's nice and safe in the NVRAM !!!!!

Enjoy your Apple I Smile

Paul.

The Code:

SCR
LOMEM=768
HIMEM=8192
20 TAB 15: PRINT "FIND THE QUEEN"
30 TAB 11: PRINT "CREATED BY PAOLO DI LEO"
40 TAB 15: PRINT "FOR THE APPLE I"
41 PRINT ""
45 DIM A$(1)
46 DIM B$(1)
60 TAB 11: PRINT "1 - PLAY THE GAME"
65 TAB 11: PRINT "2 - EXIT"
70 PRINT ""
80 TAB 11: INPUT "WHAT IS YOUR CHOICE ",A
85 IF A=1 THEN GOTO 100
86 IF A=2 THEN PRINT "BYE BYE": END
100 PRINT ""
120 TAB 11: INPUT "WHAT IS YOUR CASH $",K
125 PRINT ""
130 TAB 11: PRINT"HOW MUCH DO YOU"
131 TAB 11: INPUT "WANT TO BET $",B
132 PRINT ""
135 IF K=0 OR K<0 THEN GOSUB 4100
136 IF B>K THEN GOSUB 4000
137 Q= RND (3)+1

140 TAB 12: PRINT "+---+ +---+ +---+"
145 TAB 12: PRINT "! ! ! ! ! !"
150 TAB 12: PRINT "! ! ! ! ! !"
155 TAB 12: PRINT "! 1 ! ! 2 ! ! 3 !"
160 TAB 12: PRINT "! ! ! ! ! !"
165 TAB 12: PRINT "! ! ! ! ! !"
175 TAB 12: PRINT "+---+ +---+ +---+": PRINT ""
180 PRINT ""
185 TAB 2: INPUT "FIND THE QUEEN,PICK A CARD 1,2 OR 3 ",A$: PRINT""

186 IF A$="1" AND Q=1 THEN GOSUB 210
187 IF A$="2" AND Q=2 THEN GOSUB 305
188 IF A$="3" AND Q=3 THEN GOSUB 405
189 IF A$="1" AND Q=2 THEN GOSUB 605
190 IF A$="1" AND Q=3 THEN GOSUB 705
191 IF A$="2" AND Q=1 THEN GOSUB 505
192 IF A$="2" AND Q=3 THEN GOSUB 705
193 IF A$="3" AND Q=1 THEN GOSUB 505
194 IF A$="3" AND Q=2 THEN GOSUB 605

210 GOSUB 1000
220 TAB 11: PRINT "YOU HAVE WON! $" ;B;
225 PRINT ""
230 K=K+B
235 TAB 11: PRINT "YOUR CASH IS NOW $";K;: PRINT ""
240 TAB 11: INPUT "PLAY AGAIN (Y/N) ",B$
250 IF B$="Y" THEN GOTO 130
260 IF B$="N" THEN PRINT "BYE BYE": END
270 RETURN

305 GOSUB 2000
310 TAB 11: PRINT "YOU HAVE WON! $" ;B;
320 K=K+B
325 PRINT ""
330 TAB 11: INPUT "PLAY AGAIN (Y/N) ",B$
335 TAB 11: PRINT "YOUR CASH IS NOW $";K;: PRINT ""
340 IF B$="Y" THEN GOTO 130
370 IF B$="N" THEN PRINT "BYE BYE": END
375 RETURN

405 GOSUB 3000
410 TAB 11: PRINT "YOU HAVE WON! $ ";B;
420 K=K+B
425 PRINT ""
430 TAB 11: INPUT "PLAY AGAIN (Y/N) ",B$
435 TAB 11: PRINT "YOUR CASH IS NOW $ ";K;: PRINT ""
440 IF B$="Y" THEN GOTO 130
470 PRINT "BYE BYE": END
475 RETURN

505 GOSUB 1000
510 TAB 11: PRINT "YOU HAVE LOST $ ";B;
520 K=K-B
521 IF K=0 THEN GOTO 4100
525 PRINT ""
530 TAB 11: INPUT "PLAY AGAIN (Y/N) ",B$
535 TAB 11: PRINT "YOUR CASH IS NOW $";K;: PRINT ""
540 IF B$="Y" THEN GOTO 130
570 IF B$="N" THEN PRINT "BYE BYE": END
575 RETURN

605 GOSUB 2000
610 TAB 11: PRINT "YOU HAVE LOST $ ";B;
620 K=K-B
621 IF K=0 THEN GOTO 4100
625 PRINT ""
630 TAB 11: INPUT "PLAY AGAIN (Y/N) ",B$
635 TAB 11: PRINT "YOUR CASH IS NOW $";K;: PRINT ""
640 IF B$="Y" THEN GOTO 130
670 IF B$="N" THEN PRINT "BYE BYE": END
675 RETURN

705 GOSUB 3000
710 TAB 11: PRINT "YOU HAVE LOST $ ";B;
720 K=K-B
721 IF K=0 THEN GOTO 4100
725 PRINT ""
730 TAB 11: INPUT "PLAY AGAIN (Y/N) ",B$
735 TAB 11: PRINT "YOUR CASH IS NOW $ ";K;: PRINT ""
740 IF B$="Y" THEN GOTO 130
770 IF B$="N" THEN PRINT "BYE BYE": END
775 RETURN

1000 TAB 12: PRINT "THE CARDS ARE " : PRINT ""
1010 TAB 12: PRINT "+---+ +---+ +---+"
1020 TAB 12: PRINT "! ! ! ! ! !"
1030 TAB 12: PRINT "! ! ! ! ! !"
1040 TAB 12: PRINT "! Q ! ! 2 ! ! 3 !"
1050 TAB 12: PRINT "! ! ! ! ! !"
1060 TAB 12: PRINT "! ! ! ! ! !"
1070 TAB 12: PRINT "+---+ +---+ +---+": PRINT ""
1080 RETURN

2000 TAB 12: PRINT "THE CARDS ARE ": PRINT ""
2010 TAB 12: PRINT "+---+ +---+ +---+"
2020 TAB 12: PRINT "! ! ! ! ! !"
2030 TAB 12: PRINT "! ! ! ! ! !"
2040 TAB 12: PRINT "! 1 ! ! Q ! ! 3 !"
2050 TAB 12: PRINT "! ! ! ! ! !"
2060 TAB 12: PRINT "! ! ! ! ! !"
2070 TAB 12: PRINT "+---+ +---+ +---+": PRINT ""
2080 RETURN

3000 TAB 12: PRINT "THE CARDS ARE ": PRINT ""
3010 TAB 12: PRINT "+---+ +---+ +---+"
3020 TAB 12: PRINT "! ! ! ! ! !"
3030 TAB 12: PRINT "! ! ! ! ! !"
3040 TAB 12: PRINT "! 1 ! ! 2 ! ! Q !"
3050 TAB 12: PRINT "! ! ! ! ! !"
3060 TAB 12: PRINT "! ! ! ! ! !"
3070 TAB 12: PRINT "+---+ +---+ +---+": PRINT ""
3080 RETURN

4000 TAB 11: PRINT "YOU HAVE ONLY ";"$";K;: PRINT ""
4010 GOTO 130
4020 RETURN

4100 PRINT""
4110 TAB 11: PRINT"YOU HAVE NO MORE MONEY !!!"
4120 TAB 11: INPUT "PLAY AGAIN ...(Y/ N) ",B$
4130 IF B$="Y" THEN GOTO 100
4140 IF B$="N" THEN PRINT "BYE BYE": END
4150 RETURN

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
italianapple's picture
Offline
Joined: Jan 28 2007
Posts: 94
error correction

like the other topics, i can not post the smaller or greater signs,

BAD CODE:

135 IF K=0 OR KK THEN GOSUB 4000

GOOD CODE:

135 IF K=0 OR K "SMALLER THAN"0 THE GOSUB 4000

Well, looking better at the code, it can be wrote to as:

135 IF K=0 THEN GOSUB 4000

Paul-