// acey ducey: // This is the Acey Ducey card game. // It's a simple version of Yablon: // Aces are high . // 2 cards are dealt face-up, the player bets on the next // card being in-between, wins, loses or bet returned. cls print print space$(26);"Acey-Ducey card game" print space$(26);"====================" print space$(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY" print space$(15);"==========================================" print print print "Acey-Ducey is played in the following manner:" print " The dealer (computer) deals two cards face up." print " You have an option to bet or not bet depending" print " on whether or not you feel the card will have" print " a value between the first two." print " if you do not want to bet, input a 0 (zero)" print " Note that Aces are HIGH." // Card names dim cards$ (13) for i = 0 to 12 cycle read c$ cards$ (i) = c$ repeat data "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten" data "Jack", "Queen", "King", "Ace" // Big games loop cash = 100 // Start with $100 on the house. cycle print "You have $"; cash print print "The dealer draws these two cards: " cycle card1 = rnd (13) // 0..12 == 13 cards card2 = rnd (13) repeat until card1 < card2 // Crude, but workable print " First card is: "; cards$ (card1) print "Second card is: "; cards$ (card2) // Get the bet cycle input "What is your bet ? ", moneyBet if moneyBet = 0 then print "Giving up already? OK then." print "You leave with $"; cash; "." end endif print if moneyBet > cash then print "Sorry, my friend, but you bet too much." print "You have only $";cash;" to bet." endif repeat until moneyBet <= cash // Take the card card3 = rnd (13) print "You've drawn: "; cards$ (card3) if (card3 > card1) and (card3 < card2) then print "You WIN!" cash = cash + moneyBet else print "Sorry, YOU LOSE!" cash = cash - moneyBet endif if cash = 0 then print "Sorry, friend, but you're out of cash." break endif print print print "You now have $"; cash; "." print input "Try again (YES OR NO) ? ", A$ repeat while A$ = "YES" or A$ = "yes" print print "Hope you had fun." end // The original game // Notes -GH- // Aces are HIGH. // The program logic is somewhat odd - it picks a random fraction, // where 0 <= R < 1. This is a common type of random funciton. // Then it's multiplied it by 14, takes the integer, so 0 <= R < 13 // then 2 is added to yield 2..15 inclusive, or 14 unique numbers. // Which is strange as there are only 13 cards per suite in a standard // card deck. // The odd bit is that it then tests for < 2 or > 14 and if-so, // picks another random number! This suggests that maybe the // original RND function might be flawed or buggy? // However the result is a number from 2 to 14 inclusive representing // 13 cards in a suite. // N is set but unused in the original. // There is no common subroutine to print the card number/face name. // Another issue: There are 52 cards in a deck, yet this picks // 2 cards from a single suite (effectively). Really, the first // draw reduces the deck to 51 cards and the 2nd reduces it to 50 // cards, so the probability here is slightly wrong. // But... Remember this is for fun and not money! REM 10 PRINT TAB(26);"ACEY DUCEY CARD GAME" REM 20 PRINT TAB(15);"CREATIVE COMPUTING MORRISTOWN, NEW JERSEY" REM 21 PRINT REM 22 PRINT REM 30 PRINT"ACEY-DUCEY IS PLAYED IN THE FOLLOWING MANNER " REM 40 PRINT"THE DEALER (COMPUTER) DEALS TWO CARDS FACE UP" REM 50 PRINT"YOU HAVE AN OPTION TO BET OR NOT BET DEPENDING" REM 60 PRINT"ON WHETHER OR NOT YOU FEEL THE CARD WILL HAVE" REM 70 PRINT"A VALUE BETWEEN THE FIRST TWO." REM 80 PRINT"IF YOU DO NOT WANT TO BET, INPUT A 0" REM 100 N=100 REM 110 Q=100 Q is Money // Start of main game loop REM 120 PRINT "YOU NOW HAVE";Q;"DOLLARS." REM 130 PRINT REM 140 GOTO 260 -> Deal Cards // Add winnings to pot and repeat REM 210 Q=Q+M REM 220 GOTO 120 // Take winnings from pot and repeat REM 240 Q=Q-M REM 250 GOTO 120 // Deal Cards REM 260 PRINT"HERE ARE YOUR NEXT TWO CARDS: " // Get card 1. // Returns a number from 0..13 + 2 -> 2..15 - 14 cards? REM 270 A=INT(14*RND(1))+2 // If should never be < 2 - buggy RND? REM 280 IF A<2 THEN 270 // It could be > 14 (15). In which case why generate to that range? REM 290 IF A>14 THEN 270 // Get card 2. See above comments. REM 300 B=INT(14*RND(1))+2 REM 310 IF B<2 THEN 300 REM 320 IF B>14 THEN 300 // Check card values REM 330 IF A>=B THEN 270 - pick another 2 cards rather than swap them... // this section prints the card names or numbers. REM 350 IF A<11 THEN 400 REM 360 IF A=11 THEN 420 REM 370 IF A=12 THEN 440 REM 380 IF A=13 THEN 460 REM 390 IF A=14 THEN 480 REM 400 PRINT A REM 410 GOTO 500 REM 420 PRINT"JACK" REM 430 GOTO 500 REM 440 PRINT"QUEEN" REM 450 GOTO 500 REM 460 PRINT"KING" REM 470 GOTO 500 REM 480 PRINT"ACE" REM 500 IF B<11 THEN 550 REM 510 IF B=11 THEN 570 REM 520 IF B=12 THEN 590 REM 530 IF B=13 THEN 610 REM 540 IF B=14 THEN 630 REM 550 PRINT B REM 560 GOTO 650 REM 570 PRINT"JACK" REM 580 GOTO 650 REM 590 PRINT"QUEEN" REM 600 GOTO 650 REM 610 PRINT"KING" REM 620 GOTO 650 REM 630 PRINT"ACE" REM 640 PRINT // Get players bet REM 650 PRINT REM 660 INPUT"WHAT IS YOUR BET";M REM 670 IF M<>0 THEN 680 REM 675 PRINT"CHICKEN!!" REM 676 PRINT REM 677 GOTO 260 REM 680 IF M<=Q THEN 730 REM 690 PRINT"SORRY, MY FRIEND, BUT YOU BET TOO MUCH." REM 700 PRINT"YOU HAVE ONLY ";Q;" DOLLARS TO BET." REM 710 GOTO 650 // Get 3rd card. See above for ranges... REM 730 C=INT(14*RND(1))+2 REM 740 IF C<2 THEN 730 REM 750 IF C>14 THEN 730 REM 760 IF C<11 THEN 810 REM 770 IF C=11 THEN 830 REM 780 IF C=12 THEN 850 REM 790 IF C=13 THEN 870 REM 800 IF C=14 THEN 890 REM 810 PRINT C REM 820 GOTO 910 REM 830 PRINT"JACK" REM 840 GOTO 910 REM 850 PRINT"QUEEN" REM 860 GOTO 910 REM 870 PRINT"KING" REM 880 GOTO 910 REM 890 PRINT "ACE" REM 900 PRINT // Did we win? REM 910 IF C>A THEN 930 // Odd logic - maybe no AND? REM 920 GOTO 970 REM 930 IF C>=B THEN 970 REM 950 PRINT"YOU WIN!!!" REM 960 GOTO 210 // Generic lose code REM 970 PRINT"SORRY, YOU LOSE" REM 980 IF M