00005 ! ! ! NEWPOKER - New poker game that incorporates ! ! video graphics of the VT100. ! ! ! ! Other Features Include: ! ! ! ! 1 . Maintains a full deck of cards ! ! as opposed to randomly generating ! ! cards as they are needed. ! ! ! ! 2 . Deal procedes in correct order. ! ! ! ! 3 . Allows player to trade 4 cards if ! ! they are holding an ace. ! ! ! ! ! ! Greg Davis June, 1982 ! ! special assistance by Chuck Warner ! ! & \ DUMMY%=FNVT.INIT% & \ ON ERROR GOTO 9000 00010 ! ! ! Dimension the arrays used to hold the cards ! ! and to define the deck and hands. ! ! & \ DIM CARD(52%),CARD.DESC1$(52%),CARD.DESC2$(52%), & CARD.VALUE$(52%),DECK(52%),PLAYER.CARD(5%), & DEALER.CARD(5%),SORTED.CARD(5%),HOLD.CARD(5%) 00040 RANDOMIZE 00050 ! ! ! Define the various cards and assign them ! ! a card number. This number is used throughout ! ! the program to represent one specific card. ! ! The card value is used in determining the ! ! value of any given hand. ! ! & \ DATA 1," Ace of "," spades ","14S", & 2," Two of "," spades ","02S", & 3," Three of "," spades ","03S", & 4," Four of "," spades ","04S", & 5," Five of "," spades ","05S", & 6," Six of "," spades ","06S", & 7," Seven of "," spades ","07S", & 8," Eight of "," spades ","08S", & 9," Nine of "," spades ","09S", & 10," Ten of "," spades ","10S", & 11," Jack of "," spades ","11S", & 12," Queen of "," spades ","12S", & 13," King of "," spades ","13S", & 14," Ace of "," clubs ","14C", & 15," Two of "," clubs ","02C", & 16," Three of "," clubs ","03C", & 17," Four of "," clubs ","04C", & 18," Five of "," clubs ","05C", & 19," Six of "," clubs ","06C", & 20," Seven of "," clubs ","07C", & 21," Eight of "," clubs ","08C", & 22," Nine of "," clubs ","09C", & 23," Ten of "," clubs ","10C", & 24," Jack of "," clubs ","11C", & 25," Queen of "," clubs ","12C", & 26," King of "," clubs ","13C", & 27," Ace of "," hearts ","14H", & 28," Two of "," hearts ","02H", & 29," Three of "," hearts ","03H", & 30," Four of "," hearts ","04H", & 31," Five of "," hearts ","05H", & 32," Six of "," hearts ","06H", & 33," Seven of "," hearts ","07H", & 34," Eight of "," hearts ","08H", & 35," Nine of "," hearts ","09H", & 36," Ten of "," hearts ","10H", & 37," Jack of "," hearts ","11H", & 38," Queen of "," hearts ","12H", & 39," King of "," hearts ","13H", & 40," Ace of "," diamonds ","14D", & 41," Two of "," diamonds ","02D", & 42," Three of "," diamonds ","03D", & 43," Four of "," diamonds ","04D", & 44," Five of "," diamonds ","05D", & 45," Six of "," diamonds ","06D", & 46," Seven of "," diamonds ","07D", & 47," Eight of "," diamonds ","08D", & 48," Nine of "," diamonds ","09D", & 49," Ten of "," diamonds ","10D", & 50," Jack of "," diamonds ","11D", & 51," Queen of "," diamonds ","12D", & 52," King of "," diamonds ","13D" 00100 ! ! ! Read the card numbers and descriptions ! ! into the CARD arrays. ! ! & \ FOR CARD.CNT%=1% TO 52% & \ READ CARD(CARD.CNT%),CARD.DESC1$(CARD.CNT%), & CARD.DESC2$(CARD.CNT%),CARD.VALUE$(CARD.CNT%) & \ NEXT CARD.CNT% 00200 ! ! ! Clear the screen and start the game. ! ! & \ DUMMY%=FNVT.EEOS%(1%,1%) ! Clear entire screen & \ GOSUB 1000 ! Display basic screen 00205 ! ! ! Find out how much they want to start with ! ! & \ VT.BLK%=5% & \ REPLY$=FNVT.INUM$("How much are you willing to lose") & \ INIT.AMOUNT=VAL(REPLY$) & \ PLAYER.BANK=INIT.AMOUNT & \ DEALER.BANK=INIT.AMOUNT & \ DUMMY%=FNVM.DSPLY%("No pennies ... please !!!") & IF INIT.AMOUNT<>INT(INIT.AMOUNT) & \ GOTO 205 IF INIT.AMOUNT<>INT(INIT.AMOUNT) & \ DUMMY%=FNVM.DSPLY%("The house can only cover $ 100,000")& IF INIT.AMOUNT>100000 & \ INIT.AMOUNT=100000 IF INIT.AMOUNT>100000 & \ PLAYER.BANK=INIT.AMOUNT & \ DEALER.BANK=INIT.AMOUNT & \ GOTO 210 IF INIT.AMOUNT=100000 & \ DUMMY%=FNVM.DSPLY%("The house accepts that amount") 00210 ! ! ! Find out what the ante is ! ! & \ VT.BLK%=3% & \ REPLY$=FNVT.INUM$("What is the ante for this game") & \ ANTE.AMT=VAL(REPLY$) & \ DUMMY%=FNVM.DSPLY%("Ante is too high for given bank") & IF ANTE.AMT=>PLAYER.BANK/10 & \ GOTO 210 IF ANTE.AMT=>PLAYER.BANK/10 & \ DUMMY%=FNVM.DSPLY%("Ante is too low for given bank") & IF ANTE.AMT<=PLAYER.BANK/5000 & \ GOTO 210 IF ANTE.AMT<=PLAYER.BANK/5000 00215 ! ! ! Reduce the banks by the ante and display ! ! the updated amounts ! ! & \ VT.BLK%=1% & \ REPLY$=FNVT.ISTR$("Ante up (Y/N)") & \ GOTO 990 IF EDIT$(REPLY$,32%)="N" & \ PASS%=1% & \ PLAYER.BANK=PLAYER.BANK-ANTE.AMT & \ DEALER.BANK=DEALER.BANK-ANTE.AMT & \ POT.AMT=POT.AMT+(ANTE.AMT*2) & \ GOSUB 5500 ! Display Amounts 00220 ! ! ! Deal out the first set of cards ! ! ! ! As with a real deck, the player gets every ! ! other card, starting with the first card ! ! & \ DECK.CNT%=0% & \ GOSUB 2000 ! Shuffle the deck & \ CARD.CNT%=0% & \ FOR DEAL.CNT%=1% TO 9% STEP 2% & \ CARD.CNT%=CARD.CNT%+1% & \ DECK.CNT%=DECK.CNT%+1% & \ PLAYER.CARD(CARD.CNT%)=DECK(DEAL.CNT%) & \ DEALER.CARD(CARD.CNT%)=DECK(DEAL.CNT%+1%) & \ NEXT DEAL.CNT% & \ GOSUB 1500 00240 ! ! ! It's time to place our first bets ! ! & \ GOSUB 3500 ! Prompt bet amount & \ GOTO 260 IF CHECK.FLAG%=1% ! They checked the bet & \ GOTO 900 IF FOLD.FLAG%=1% ! They folded 00250 ! ! ! Now we check the quality of our hand ! ! & \ DEALER.FLAG%=1% & \ GOSUB 3000 ! Determine Hand Value & \ GOTO 300 IF HAND.VALUE%=1% ! Fold & \ GOTO 260 IF CHECK.FLAG%=1% ! Decide how much to bet& \ GOTO 350 ! We got potential 00260 ! ! ! Player has checked the bet to us. ! ! Decide whether or not to bet. If so, ! ! calculate the bet amount and re-prompt them ! ! for same. ! ! & \ IF HAND.VALUE%<3% AND BLUFF.FLAG%=0% THEN & DUMMY%=FNVM.DSPLY%("I check as well ...") & \ BET.AMOUNT=0 & \ GOTO 400 00270 ! ! ! Either our hand is substancial or we are ! ! bluffing. Either way, we're placing a bet. ! ! & \ BET.AMOUNT=INT(PLAYER.BANK/20) & \ BET.AMOUNT=DEALER.BANK IF BET.AMOUNT>DEALER.BANK & \ BET.AMOUNT=PLAYER.BANK IF BET.AMOUNTDEALER.BANK & ! ! ! Make sure they've covered our bet ! ! & \ DUMMY%=FNVM.DSPLY%("Either see the bet, raise it or fold")& IF BET.AMOUNT0 & \ BET.AMOUNT=RAISE.AMT & \ DEALER.BANK=DEALER.BANK-BET.AMOUNT & \ POT.AMT=POT.AMT+BET.AMOUNT & \ GOSUB 5500 ! Display Amounts & \ HOLD.BLUFF%=BLUFF.FLAG% & \ BLUFF.FLAG%=0% & \ GOTO 350 IF HAND.VALUE%>7% AND RAISE.AMT<>0 & OR HOLD.BLUFF%=1% AND RAISE.AMT<>0 & \ GOTO 300 IF HAND.VALUE%<8% AND RAISE.AMT<>0 & OR HOLD.BLUFF%=0% AND RAISE.AMT<>0 & \ GOTO 400 ! The bet was called 00300 ! ! ! *** Computer Decision Section *** ! ! ! ! Hand has no value, fold and update amounts ! ! & \ DUMMY%=FNVM.DSPLY%("I fold ...") & \ GOTO 900 IF CHECK.FLAG%=1% & \ PLAYER.BANK=PLAYER.BANK+POT.AMT & \ POT.AMT=0 & \ GOSUB 5500 ! Display Amounts & \ GOTO 900 00350 ! ! ! The odds are in our favor. Cover the bet ! ! & \ GOTO 900 IF BET.AMOUNT>DEALER.BANK & \ DUMMY%=FNVT.OSTR%(2%,1%,"Your bet is covered ...") 00400 ! ! ! Calculate new amounts (after covering bet) ! ! display new amounts. Decide whether or ! ! no to raise the bet. ! ! & \ GOSUB 2500 IF BLUFF.FLAG%=1% ! Calculate bluff amt. & \ POT.AMT=POT.AMT+BET.AMOUNT & \ DEALER.BANK=DEALER.BANK-BET.AMOUNT & \ GOSUB 5500 ! Display amounts & \ GOTO 290 IF BLUFF.FLAG%=1% ! Re-prompt bet & \ DUMMY%=FNVT.EEOL%(2%,1%) ! Erase message line & \ PASS%=2% & ! ! ! It's time to trade in some cards ! ! & \ GOSUB 4000 ! Let player trade first& \ GOSUB 5000 ! Computer trades cards & \ GOSUB 3000 ! Re-evaluate hand & ! ! ! It's time to place our second bets ! ! & \ GOSUB 3500 ! Prompt bet amount & \ GOTO 450 IF CHECK.FLAG%=1% ! They checked the bet & \ GOTO 900 IF FOLD.FLAG%=1% ! They folded 00450 ! ! ! The player checked the bet again. ! ! Decide whether or not to continue. ! ! & \ GOTO 500 00500 ! ! ! It's time to compare hands. To do this, ! ! we move the players hand into the dealer's ! ! array and evaluate the hand. ! ! & \ GOTO 300 IF BET.AMOUNT>DEALER.BANK/2 AND HAND.VALUE%<8% & \ GOTO 300 IF BET.AMOUNT>DEALER.BANK & \ GOTO 300 IF HOLD.BLUFF%=1% AND HAND.VALUE%<4% & \ DEALER.BANK=DEALER.BANK-BET.AMOUNT & \ POT.AMT=POT.AMT+BET.AMOUNT & \ GOSUB 5500 ! Display New Amounts & \ DEALER.FLAG%=0% & \ DEALER.HAND.VALUE%=HAND.VALUE% & \ DEALER.ACE.LOC%=ACE.LOC% & \ DEALER.KEPT.CARDS$=KEEP.CARD.NUMBERS$ & \ DEALER.PAIR.CARD.1%=FIRST.PAIR.CARD% & \ DEALER.PAIR.CARD.2%=SECOND.PAIR.CARD% & \ FOR X%=1% TO 5% & \ HOLD.CARD(X%)=DEALER.CARD(X%) ! Save the dealers hand & \ DEALER.CARD(X%)=PLAYER.CARD(X%) ! Move players hand & \ NEXT X% & \ GOSUB 3000 ! Evaluate Player's hand& ! ! ! Get the names for the two hands ! ! & \ WORK.VALUE%=HAND.VALUE% ! Player hand value & \ GOSUB 4500 ! Get name for hand & \ PLAYER.HAND$=WORK.NAME$ ! Player hand name & \ WORK.VALUE%=DEALER.HAND.VALUE% ! Dealer hand value & \ GOSUB 4500 ! Get name for hand & \ DEALER.HAND$=WORK.NAME$ ! Dealer hand name & ! ! ! Decide who won the round and act accordingly ! ! & \ GOSUB 6000 ! Display dealer's hand & \ DEALER.HAND.VALUE%=DEALER.HAND.VALUE%+1% & IF DEALER.HAND.VALUE%=HAND.VALUE% AND & DEALER.PAIR.CARD.1%>FIRST.PAIR.CARD% & \ DEALER.HAND.VALUE%=DEALER.HAND.VALUE%+1% & IF DEALER.HAND.VALUE%=HAND.VALUE% AND & DEALER.PAIR.CARD.2%>SECOND.PAIR.CARD% & \ HAND.VALUE%=HAND.VALUE%+1% & IF HAND.VALUE%=DEALER.HAND.VALUE% AND & FIRST.PAIR.CARD%>DEALER.PAIR.CARD.1% & \ HAND.VALUE%=HAND.VALUE%+1% & IF HAND.VALUE%=DEALER.HAND.VALUE% AND & SECOND.PAIR.CARD%>DEALER.PAIR.CARD.2% & \ GOTO 510 IF DEALER.HAND.VALUE%HAND.VALUE% & \ GOTO 550 00510 ! ! ! The player won that round. Inform them ! ! and update the amount accordingly. ! ! & \ MESSAGE$="Your "+PLAYER.HAND$+" beats my "+DEALER.HAND$ & \ DUMMY%=FNVM.DSPLY%(MESSAGE$) & \ PLAYER.BANK=PLAYER.BANK+POT.AMT & \ POT.AMT=0 & \ GOSUB 5500 ! Display Amounts & \ GOTO 900 00520 ! ! ! We won that round. Give him the bad news ! ! and rake in the money. ! ! & \ MESSAGE$="My "+DEALER.HAND$+" beats your "+PLAYER.HAND$ & \ DUMMY%=FNVM.DSPLY%(MESSAGE$) & \ DEALER.BANK=DEALER.BANK+POT.AMT & \ POT.AMT=0 & \ GOSUB 5500 ! Display amounts & \ GOTO 900 00550 ! ! ! The hand values were the same (probably ! ! because neither of us had anything). ! ! Attempt to define a winner, otherwise go ! ! on to next hand (leaving the pot alone). ! ! & \ DUMMY%=FNVM.DSPLY%("Neither of us had anything") & IF DEALER.HAND.VALUE%=1% AND HAND.VALUE%=1% & \ GOTO 900 IF DEALER.HAND.VALUE%=1% AND HAND.VALUE%=1% & \ DUMMY%=FNVM.DSPLY%("We tied ... pot remains the same") & \ GOTO 900 00900 ! ! ! Clean up the variables and the screen ! ! and go back for another hand. ! ! & \ DEALER.BANK=DEALER.BANK+POT.AMT IF FOLD.FLAG%=1% & \ POT.AMT=0 IF FOLD.FLAG%=1% & \ GOSUB 5500 ! Display amounts & ! ! ! Check to see if the player broke our bank ! ! & \ DUMMY%=FNVM.DSPLY%("Congratulations ... you broke the bank")& IF DEALER.BANKINIT.AMOUNT & \ DUMMY%=FNVM.DSPLY%(MESSAGE$) & \ GOTO 32750 01000 ! ! ! Subroutine to display screen skeleton ! ! & \ DUMMY%=FNVT.EEOS%(1%,1%) & \ DUMMY%=FNVT.OSTR%(3%,6%,GC$+"lqqqqwqqqqqqqqk "+ & "lqqqqqqqwqqqqqqqqk lqqqqqqqqwqqqqqqqqk") & \ DUMMY%=FNVT.OSTR%(4%,6%,"x"+KM$+"Your"+GC$+"x "+ & "x x"+KM$+"Current"+GC$+"x x "+& "x"+KM$+"Dealer's"+GC$+"x x") & \ DUMMY%=FNVT.OSTR%(5%,6%,"x"+KM$+"Bank"+GC$+"x "+ & "x x"+KM$+" Pot "+GC$+"x x "+& "x"+KM$+" Bank "+GC$+"x x") & \ DUMMY%=FNVT.OSTR%(6%,6%,GC$+"mqqqqvqqqqqqqqj "+ & "mqqqqqqqvqqqqqqqqj mqqqqqqqqvqqqqqqqqj") & \ PRINT CHR$(27%);"[11";CHR$(59%);"3H";DBL.TOP$;GRAPHIC$;& "lqqqqqklqqqqqklqqqqqklqqqqqklqqqqqk" & \ PRINT DBL.TOP$;" x xx xx xx xx x" & \ PRINT DBL.TOP$;" x xx xx xx xx x" & \ PRINT DBL.BOT$;" x xx xx xx xx x" & \ PRINT DBL.TOP$;" x xx xx xx xx x" & \ PRINT DBL.BOT$;" x xx xx xx xx x" & \ PRINT DBL.TOP$;" x xx xx xx xx x" & \ PRINT DBL.TOP$;" x xx xx xx xx x" & \ PRINT DBL.BOT$;" x xx xx xx xx x" & \ PRINT DBL.TOP$;" mqqqqqjmqqqqqjmqqqqqjmqqqqqjmqqqqqj" & \ PRINT DBL.BOT$;" "; & NORMALC$ & \ S12$=STRING$(12%,32%) & \ RC$=REVCURS$ & \ NC$=NRMCURS$ & \ DUMMY%=FNVT.OSTR%(22%,6%,RC$+S12$+NC$+" "+RC$+S12$+ & NC$+" "+RC$+S12$+NC$+" "+RC$+S12$+NC$+" "+ & RC$+S12$+NC$) & \ DUMMY%=FNVT.OSTR%(23%,6%,RC$+S12$+NC$+" "+RC$+S12$+ & NC$+" "+RC$+S12$+NC$+" "+RC$+S12$+NC$+" "+ & RC$+S12$+NC$) & \ RETURN 01500 ! ! ! Subroutine to display cards in players hand ! ! ! ! Display the players hand on the blank card ! ! images (already on screen). ! ! & \ FOR SCRN%=7% TO 10% & \ DUMMY%=FNVT.EEOL%(SCRN%,1%) ! Erase Dealers cards & \ NEXT SCRN% & \ FOR SCRN%=11% TO 17% & \ DUMMY%=FNVT.EEOL%(SCRN%,38%) & \ NEXT SCRN% & \ FOR SCRN%=13% TO 14% & \ DUMMY%=FNVT.ECHR%(SCRN%,4%,3%) & \ DUMMY%=FNVT.ECHR%(SCRN%,11%,3%) & \ DUMMY%=FNVT.ECHR%(SCRN%,18%,3%) & \ DUMMY%=FNVT.ECHR%(SCRN%,25%,3%) & \ DUMMY%=FNVT.ECHR%(SCRN%,32%,3%) & \ NEXT SCRN% & \ FOR SCRN%=18% TO 19% & \ DUMMY%=FNVT.ECHR%(SCRN%,6%,3%) & \ DUMMY%=FNVT.ECHR%(SCRN%,13%,3%) & \ DUMMY%=FNVT.ECHR%(SCRN%,20%,3%) & \ DUMMY%=FNVT.ECHR%(SCRN%,27%,3%) & \ DUMMY%=FNVT.ECHR%(SCRN%,34%,3%) & \ NEXT SCRN% & ! ! ! Display first (left most) Card Graphics ! ! & \ CARD.NAME$=CARD.VALUE$(PLAYER.CARD(1%)) & \ GOSUB 1600 & \ DUMMY%=FNVT.OSTR%(13%,4%,CARD.NUM$+CARD.CHAR.1$) & \ DUMMY%=FNVT.OSTR%(14%,4%,CARD.NUM$+CARD.CHAR.2$) & \ COL%=7% & \ COL%=6% IF CARD.NUM$="10" & \ DUMMY%=FNVT.OSTR%(18%,COL%,CARD.NUM$+CARD.CHAR.1$) & \ DUMMY%=FNVT.OSTR%(19%,COL%,CARD.NUM$+CARD.CHAR.2$) & ! ! ! Display second Card Graphics ! ! & \ CARD.NAME$=CARD.VALUE$(PLAYER.CARD(2%)) & \ GOSUB 1600 & \ DUMMY%=FNVT.OSTR%(13%,11%,CARD.NUM$+CARD.CHAR.1$) & \ DUMMY%=FNVT.OSTR%(14%,11%,CARD.NUM$+CARD.CHAR.2$) & \ COL%=14% & \ COL%=13% IF CARD.NUM$="10" & \ DUMMY%=FNVT.OSTR%(18%,COL%,CARD.NUM$+CARD.CHAR.1$) & \ DUMMY%=FNVT.OSTR%(19%,COL%,CARD.NUM$+CARD.CHAR.2$) & ! ! ! Display third Card Graphics ! ! & \ CARD.NAME$=CARD.VALUE$(PLAYER.CARD(3%)) & \ GOSUB 1600 & \ DUMMY%=FNVT.OSTR%(13%,18%,CARD.NUM$+CARD.CHAR.1$) & \ DUMMY%=FNVT.OSTR%(14%,18%,CARD.NUM$+CARD.CHAR.2$) & \ COL%=21% & \ COL%=20% IF CARD.NUM$="10" & \ DUMMY%=FNVT.OSTR%(18%,COL%,CARD.NUM$+CARD.CHAR.1$) & \ DUMMY%=FNVT.OSTR%(19%,COL%,CARD.NUM$+CARD.CHAR.2$) & ! ! ! Display fourth Card Graphics ! ! & \ CARD.NAME$=CARD.VALUE$(PLAYER.CARD(4%)) & \ GOSUB 1600 & \ DUMMY%=FNVT.OSTR%(13%,25%,CARD.NUM$+CARD.CHAR.1$) & \ DUMMY%=FNVT.OSTR%(14%,25%,CARD.NUM$+CARD.CHAR.2$) & \ COL%=28% & \ COL%=27% IF CARD.NUM$="10" & \ DUMMY%=FNVT.OSTR%(18%,COL%,CARD.NUM$+CARD.CHAR.1$) & \ DUMMY%=FNVT.OSTR%(19%,COL%,CARD.NUM$+CARD.CHAR.2$) & ! ! ! Display fifth Card Graphics ! ! & \ CARD.NAME$=CARD.VALUE$(PLAYER.CARD(5%)) & \ GOSUB 1600 & \ DUMMY%=FNVT.OSTR%(13%,32%,CARD.NUM$+CARD.CHAR.1$) & \ DUMMY%=FNVT.OSTR%(14%,32%,CARD.NUM$+CARD.CHAR.2$) & \ COL%=35% & \ COL%=34% IF CARD.NUM$="10" & \ DUMMY%=FNVT.OSTR%(18%,COL%,CARD.NUM$+CARD.CHAR.1$) & \ DUMMY%=FNVT.OSTR%(19%,COL%,CARD.NUM$+CARD.CHAR.2$) & \ PRINT REVCURS$; & \ DUMMY%=FNVT.OSTR%(22%,6%,CARD.DESC1$(PLAYER.CARD(1%))) & \ DUMMY%=FNVT.OSTR%(22%,20%,CARD.DESC1$(PLAYER.CARD(2%))) & \ DUMMY%=FNVT.OSTR%(22%,34%,CARD.DESC1$(PLAYER.CARD(3%))) & \ DUMMY%=FNVT.OSTR%(22%,48%,CARD.DESC1$(PLAYER.CARD(4%))) & \ DUMMY%=FNVT.OSTR%(22%,62%,CARD.DESC1$(PLAYER.CARD(5%))) & \ DUMMY%=FNVT.OSTR%(23%,6%,CARD.DESC2$(PLAYER.CARD(1%))) & \ DUMMY%=FNVT.OSTR%(23%,20%,CARD.DESC2$(PLAYER.CARD(2%))) & \ DUMMY%=FNVT.OSTR%(23%,34%,CARD.DESC2$(PLAYER.CARD(3%))) & \ DUMMY%=FNVT.OSTR%(23%,48%,CARD.DESC2$(PLAYER.CARD(4%))) & \ DUMMY%=FNVT.OSTR%(23%,62%,CARD.DESC2$(PLAYER.CARD(5%))) & \ PRINT NRMCURS$; & \ RETURN 01600 ! ! ! Convert Card Values to Graphic Representations ! ! & \ GC$=CHR$(27%)+"(0" & \ NC$=CHR$(27%)+"(B" & \ CARD.NUM$=NUM1$(VAL(LEFT(CARD.NAME$,2%))) & \ CARD.NUM$="A" IF CARD.NUM$="14" & \ CARD.NUM$="K" IF CARD.NUM$="13" & \ CARD.NUM$="Q" IF CARD.NUM$="12" & \ CARD.NUM$="J" IF CARD.NUM$="11" & \ CARD.SUIT$=RIGHT(CARD.NAME$,3%) & ! ! ! Define Graphic Representaion of Suit ! ! & \ CARD.CHAR.1$=GC$+"`"+NC$ IF CARD.SUIT$="D" & \ CARD.CHAR.2$=GC$+"`"+NC$ IF CARD.SUIT$="D" & \ CARD.CHAR.1$="*" IF CARD.SUIT$="C" & \ CARD.CHAR.2$=GC$+"|"+NC$ IF CARD.SUIT$="C" & \ CARD.CHAR.1$="^" IF CARD.SUIT$="S" & \ CARD.CHAR.2$="$" IF CARD.SUIT$="S" & \ CARD.CHAR.1$="*" IF CARD.SUIT$="H" & \ CARD.CHAR.2$=GC$+"`"+NC$ IF CARD.SUIT$="H" & \ RETURN 02000 ! ! ! Subroutine to shuffle the deck ! ! & \ FOR X%=1% TO 52% 02010 CARD.NUMBER%=INT(RND*100) & \ CARD.NUMBER%=INT(CARD.NUMBER%/2%) IF CARD.NUMBER%>52% & \ GOTO 2010 IF CARD.NUMBER%=0% & \ FOR Y%=1% TO X%-1% & \ GOTO 2010 IF CARD.NUMBER%=DECK(Y%) & \ NEXT Y% & \ DECK(X%)=CARD.NUMBER% & \ NEXT X% & \ RETURN 02500 ! ! ! Subroutine to raise the bet (or bluff) ! ! & \ RAISE.AMT=INT((DEALER.BANK-BET.AMOUNT)/10) & \ BET.AMOUNT=BET.AMOUNT+RAISE.AMT & \ PRINT " and I raise you ";RAISE.AMT;" dollars" & \ RETURN 03000 ! ! ! Subroutine to evaluate computer's hand ! ! & \ KEEP.CARD.NUMBERS$="" ! Init Card locator & \ KEEP.ACE.LOC%=0% ! Init Ace Locator & \ HAND.VALUE%=1% ! Init to No value hand & \ FIRST.PAIR.CARD%=0% ! Init to no card & \ SECOND.PAIR.CARD%=0% ! Init to no card & \ FIRST.MATCH.FLAG%=0% ! Init first match flag & \ SECOND.MATCH.FLAG%=0% ! Init second match flag& \ FLAG.SW%=1% ! Init Match Flag Switch& \ ACE.FLAG%=0% ! Init Ace counter & \ CARD.VALUE%=0% ! Init Card Value & ! ! ! Sort the cards by value first ! ! & \ FOR X%=1% TO 5% & \ HOLD.VALUE%=CARD.VALUE% ! Hold for match check & \ CARD.NUMBER%=0% & \ CARD.VALUE%=0% & ! ! ! Get the next highest card value in hand ! ! & \ FOR Y%=1% TO 5% & ! ! ! Add one to ace counter if card is Ace ! ! & \ ACE.FLAG%=ACE.FLAG%+1% & IF VAL(LEFT(CARD.VALUE$(DEALER.CARD(Y%)),2%))=14& \ KEEP.ACE.LOC%=Y% & IF VAL(LEFT(CARD.VALUE$(DEALER.CARD(Y%)),2%))=14& ! ! ! Hold new high card number and value ! ! & \ CARD.NUMBER%=Y% & IF VAL(LEFT(CARD.VALUE$(DEALER.CARD(Y%)),2%))=> & CARD.VALUE% & \ CARD.VALUE%=VAL(LEFT(CARD.VALUE$(DEALER.CARD(Y%)),2%)) & IF VAL(LEFT(CARD.VALUE$(DEALER.CARD(Y%)),2%))=> & CARD.VALUE% & ! ! ! Hold Good card locations so we can erase ! ! bad cards later. ! ! & \ KEEP.CARD.NUMBERS$=KEEP.CARD.NUMBERS$+NUM1$(X%-1%) & +NUM1$(X%) IF CARD.VALUE%=HOLD.VALUE% & \ NEXT Y% & ! ! ! Set match switch to point to correct match ! ! flag. This allows us to maintain the number ! ! of matching cards (pairs, triplets, quads). ! ! & \ FLAG.SW%=2% IF FIRST.MATCH.FLAG%<>0% AND FLAG.SW%=1% & AND CARD.VALUE%<>HOLD.VALUE% & \ FLAG.SW%=3% IF SECOND.MATCH.FLAG%<>0% AND FLAG.SW%=2% & AND CARD.VALUE%<>HOLD.VALUE% & ! ! ! Add one to correct match counter if card ! ! value is the same as the card the preceeded it. ! ! & \ FIRST.MATCH.FLAG%=FIRST.MATCH.FLAG%+1% & IF CARD.VALUE%=HOLD.VALUE% AND FLAG.SW%=1% & \ FIRST.PAIR.CARD%=CARD.VALUE% & IF CARD.VALUE%=HOLD.VALUE% AND FLAG.SW%=1% & \ SECOND.MATCH.FLAG%=SECOND.MATCH.FLAG%+1% & IF CARD.VALUE%=HOLD.VALUE% AND FLAG.SW%=2% & \ SECOND.PAIR.CARD%=CARD.VALUE% & IF CARD.VALUE%=HOLD.VALUE% AND FLAG.SW%=2% & ! ! ! ! ! Now position it in the sorted deck and erase ! ! from dealer hand to prevent duplicate entry. ! ! & \ SORTED.CARD(X%)=DEALER.CARD(CARD.NUMBER%) & \ DEALER.CARD(CARD.NUMBER%)=0 & \ NEXT X% 03010 ! ! ! Move sorted hand to dealer hand for evaluation ! ! & \ FOR X%=1% TO 5% & \ DEALER.CARD(X%)=SORTED.CARD(X%) & \ NEXT X% 03020 ! ! ! Evaluate Sorted Hand ! ! ! ! Check for nothing except one ace ! ! & \ HAND.VALUE%=2% IF ACE.FLAG%=1% AND PASS%=1% & ! ! ! Check for One Pair ! ! & \ HAND.VALUE%=3% IF FIRST.MATCH.FLAG%=1% & ! ! ! Check for two pair ! ! & \ HAND.VALUE%=4% IF FIRST.MATCH.FLAG%=1% & AND SECOND.MATCH.FLAG%=1% & ! ! ! Check for Open or Closed Flush ! ! & \ FLUSH.FLAG%=0% & \ BAD.FL.CARD%=0% & \ HOLD.SUIT.1$=RIGHT(CARD.VALUE$(DEALER.CARD(1%)),3%) & \ FOR X%=2% TO 5% & \ WORK.SUIT$=RIGHT(CARD.VALUE$(DEALER.CARD(X%)),3%) & \ FLUSH.FLAG%=FLUSH.FLAG%+1% IF WORK.SUIT$<>HOLD.SUIT.1$ & \ FLUSH.FLAG%=FLUSH.FLAG%-1% IF WORK.SUIT$=HOLD.SUIT.2$ & AND PASS%=1% & ! ! ! Save bad card number (for open flush only) ! ! & \ BAD.FL.CARD%=X% IF WORK.SUIT$<>HOLD.SUIT.1$ & \ BAD.FL.CARD%=X%-1% IF WORK.SUIT$=HOLD.SUIT.2$ & ! ! ! If match found on second held suit, make ! ! it the new suit to check against. ! ! & \ HOLD.SUIT.1$=WORK.SUIT$ IF WORK.SUIT$=HOLD.SUIT.2$ & \ HOLD.SUIT.2$="" IF WORK.SUIT$=HOLD.SUIT.2$ & \ HOLD.SUIT.2$=WORK.SUIT$ IF HOLD.SUIT.1$<>WORK.SUIT$ & \ NEXT X% & \ HAND.VALUE%=5% IF FLUSH.FLAG%=1% AND PASS%=1% ! Open Flush& ! ! ! Check for Open or Closed Straight ! ! & \ STRAIGHT.FLAG%=0% & \ BAD.ST.CARD%=0% & \ FOR X%=2% TO 5% & \ ADD.SW%=0% & \ ADD.SW%=1% IF VAL(LEFT(CARD.VALUE$(DEALER.CARD(X%)),2%))<>& VAL(LEFT(CARD.VALUE$(DEALER.CARD(X%-1%)),2%))-1%& \ STRAIGHT.FLAG%=STRAIGHT.FLAG%+ADD.SW% & \ BAD.ST.CARD%=X% IF ADD.SW%=1% ! Hold out-of-sync number& \ NEXT X% & \ HAND.VALUE%=6% IF STRAIGHT.FLAG%=1% AND PASS%=1% & ! ! ! Check for Open Straight Flush ! ! & \ HAND.VALUE%=7% IF BAD.FL.CARD%=BAD.ST.CARD% AND & STRAIGHT.FLAG%=1% AND FLUSH.FLAG%=1% AND PASS%=1%& ! ! ! Check for three of a kind ! ! & \ HAND.VALUE%=8% IF FIRST.MATCH.FLAG%=2% & \ HAND.VALUE%=9% IF FLUSH.FLAG%=0% ! Closed Flush & \ HAND.VALUE%=10% IF STRAIGHT.FLAG%=0% ! Closed straight& ! ! ! Check for Full House ! ! & \ HAND.VALUE%=11% IF SECOND.MATCH.FLAG%=1% & AND FIRST.MATCH.FLAG%=2% & \ HAND.VALUE%=11% IF FIRST.MATCH.FLAG%=1% & AND SECOND.MATCH.FLAG%=2% & ! ! ! Check for Royal Straight ! ! & \ HAND.VALUE%=12% IF STRAIGHT.FLAG%=0% AND & VAL(LEFT(CARD.VALUE$(DEALER.CARD(1%)),2%))=14 & ! ! ! Check for Straight Flush ! ! & \ HAND.VALUE%=13% IF STRAIGHT.FLAG%=0% AND FLUSH.FLAG%=0% & ! ! ! Check for Four of a kind ! ! & \ HAND.VALUE%=14% IF FIRST.MATCH.FLAG%=3% OR & SECOND.MATCH.FLAG%=3% & ! ! ! Check for Royal Straight Flush ! ! & \ HAND.VALUE%=15% IF STRAIGHT.FLAG%=0% AND FLUSH.FLAG%=0% & AND VAL(LEFT(CARD.VALUE$(DEALER.CARD(1%)),2%))=14& \ RETURN IF DEALER.FLAG%<>1% 03050 ! ! ! Erase the unneeded cards (dealer only and only ! ! before trading in) to allow trading. ! ! & \ GOTO 3090 IF HAND.VALUE%=>9% ! Determine Bluff Factor& \ GOTO 3070 IF HAND.VALUE%=5% OR HAND.VALUE%=6% & OR HAND.VALUE%=7% & ! ! ! Loop to erase unneeded cards when building ! ! on matching values (pairs or triplets). ! ! & \ DEALER.TRADE%=0% & \ FOR X%=5% TO 1% STEP -1% & \ GOTO 3055 IF INSTR(1%,KEEP.CARD.NUMBERS$,NUM1$(X%))<>0% & \ DEALER.TRADE%=DEALER.TRADE%+1% & \ GOTO 3090 IF DEALER.TRADE%=3% AND ACE.FLAG%=0% & \ GOTO 3090 IF DEALER.TRADE%=4% & \ DEALER.CARD(X%)=0 03055 NEXT X% & \ GOTO 3090 ! Determine Bluff factor 03070 ! ! ! Special Routine to remove unneeded card from ! ! open straights and open flushes. ! ! & \ DEALER.TRADE%=1% & \ DEALER.CARD(BAD.FL.CARD%)=0 IF HAND.VALUE%=5% & \ DEALER.CARD(BAD.ST.CARD%)=0 IF HAND.VALUE%=6% 03090 ! ! ! Determine Bluff Factor (used to detrmine ! ! whether or not to raise the bet) ! ! & \ BLUFF.FLAG%=INT((HAND.VALUE%-2)*RND) & \ DEALER.FLAG%=0% & \ RETURN 03500 ! ! ! Bet Prompt - Accepts and verifies amount ! ! & \ CHECK.FLAG%=0% & \ FOLD.FLAG%=0% & \ VT.BLK%=4% & \ REPLY$=FNVT.ISTR$("Your bet") & \ CHECK.FLAG%=1% IF EDIT$(REPLY$,32%)="CHECK" & \ FOLD.FLAG%=1% IF EDIT$(REPLY$,32%)="FOLD" & \ RETURN IF CHECK.FLAG%=1% & \ RETURN IF FOLD.FLAG%=1% & ! ! ! Make sure bet is a valid Integer ! ! & \ BET.AMT$=XLATE(REPLY$,XLT.NUM$) & \ DUMMY%=FNVM.DSPLY%("Bet either an amount, check or fold")& IF BET.AMT$<>REPLY$ & \ GOTO 3500 IF BET.AMT$<>REPLY$ & ! ! ! Dont allow decimals in the bet amount ! ! & \ BET.AMOUNT=INT(VAL(BET.AMT$)) & \ DUMMY%=FNVM.DSPLY%("No pennies ... please !!!") & IF BET.AMOUNT<>VAL(BET.AMT$) & \ GOTO 3500 IF BET.AMOUNT<>VAL(BET.AMT$) & \ FOLD.FLAG%=1% IF BET.AMOUNT=0 & \ RETURN IF BET.AMOUNT=0 & ! ! ! Make sure their bank can cover the bet ! ! & \ DUMMY%=FNVM.DSPLY%("You haven't got that much to bet") & IF BET.AMOUNT>PLAYER.BANK & \ GOTO 3500 IF BET.AMOUNT>PLAYER.BANK & ! ! ! Display Updated Pot Amount and Bank Account ! ! & \ POT.AMT=POT.AMT+BET.AMOUNT & \ PLAYER.BANK=PLAYER.BANK-BET.AMOUNT & \ GOSUB 5500 ! Display amounts & \ RETURN 04000 ! ! ! Trade in player's cards ! ! & \ DUMMY%=FNVT.OSTR%(2%,1%,"To trade a card, press the"+ & " corresponding number on the keypad, 0 to end")& \ PRINT CHR$(27%);"=" ! Use applications mode & ! ! ! Read the player's hand searching for aces ! ! & \ PLAYER.ACE%=0% & \ PLAYER.ACE.LOC$="" & \ FOR X%=1% TO 5% & \ PLAYER.ACE%=PLAYER.ACE%+1% & IF LEFT(CARD.VALUE$(PLAYER.CARD(X%)),2%)="14" & ! ! ! Hold the ace location so that if they trade ! ! in the ace we can prevent a fourth trade ! ! & \ PLAYER.ACE.LOC$=PLAYER.ACE.LOC$+NUM1$(X%) & IF LEFT(CARD.VALUE$(PLAYER.CARD(X%)),2%)="14" & \ NEXT X% & \ TRADE.CNT%=0% 04010 GOTO 4030 IF TRADE.CNT%=3% AND PLAYER.ACE%<>1% & \ GOTO 4030 IF TRADE.CNT%=4% & \ PRINT HOME$;CHR$(27%);"[0K"; ! Position cursor & \ INPUT LINE REPLY$ ! Accept keypad input & ! ! ! If they hit the 0 key, terminate this routine ! ! & \ GOTO 4030 IF REPLY$=CHR$(27%)+"Op" & ! ! ! Hold the card number to be traded ! ! & \ TRADE.CARD%=0% & \ TRADE.CARD%=1% IF REPLY$=CHR$(27%)+"Oq" & \ TRADE.CARD%=2% IF REPLY$=CHR$(27%)+"Or" & \ TRADE.CARD%=3% IF REPLY$=CHR$(27%)+"Os" & \ TRADE.CARD%=4% IF REPLY$=CHR$(27%)+"Ot" & \ TRADE.CARD%=5% IF REPLY$=CHR$(27%)+"Ou" & \ DUMMY%=FNVM.DSPLY%("Invalid card number") IF TRADE.CARD%=0%& \ GOTO 4010 IF TRADE.CARD%=0% & ! ! ! If they trade in an ace, reduce the ace count. ! ! If they attempt to trade their last ace on the ! ! fourth trade, stop them. ! ! & \ TRADE.ACE.FLAG%=0% & \ TRADE.ACE.FLAG%=1% & IF INSTR(1%,PLAYER.ACE.LOC$,NUM1$(TRADE.CARD%))<>0%& \ DUMMY%=FNVM.DSPLY%("You cant trade your ace now") & IF TRADE.CNT%=3% AND TRADE.ACE.FLAG%=1% & \ GOTO 4010 IF TRADE.CNT%=3% AND TRADE.ACE.FLAG%=1% & \ PLAYER.ACE%=PLAYER.ACE%-1% IF TRADE.ACE.FLAG%=1% & ! ! ! Erase old card corresponding to number hit. ! ! & \ PLAYER.CARD(1%)=0 IF TRADE.CARD%=1% & \ PLAYER.CARD(2%)=0 IF TRADE.CARD%=2% & \ PLAYER.CARD(3%)=0 IF TRADE.CARD%=3% & \ PLAYER.CARD(4%)=0 IF TRADE.CARD%=4% & \ PLAYER.CARD(5%)=0 IF TRADE.CARD%=5% & \ TRADE.CNT%=TRADE.CNT%+1% & \ GOTO 4010 04030 ! ! ! Replace any erased card with next card from ! ! deck. Bump up trade in count to make sure ! ! they dont trade in too many cards. ! ! & \ PRINT HOME$;CHR$(10%);CHR$(27%);"[0K"; ! Erase prompt & \ DECK.CNT%=10% ! Start with 11th card & \ FOR X%=1% TO 5% & \ PLAYER.CARD%=PLAYER.CARD(X%) & \ PLAYER.CARD(X%)=DECK(DECK.CNT%+1%) IF PLAYER.CARD%=0% & \ DECK.CNT%=DECK.CNT%+1% IF PLAYER.CARD%=0% & \ TRADE.CNT%=TRADE.CNT%+1% & \ NEXT X% & \ GOSUB 1500 ! Display new card & \ PRINT CHR$(27%);">" ! Back to Keypad mode & \ RETURN 04500 ! ! ! Assign a name to the hands we have. ! ! & \ WORK.NAME$="Nothing" IF WORK.VALUE%<3% & \ WORK.NAME$="Pair" IF WORK.VALUE%=3% & \ WORK.NAME$="Two Pair" IF WORK.VALUE%=4% & \ WORK.NAME$="Three of a kind" IF WORK.VALUE%=8% & \ WORK.NAME$="Flush" IF WORK.VALUE%=9% & \ WORK.NAME$="Straight" IF WORK.VALUE%=10% & \ WORK.NAME$="Full House" IF WORK.VALUE%=11% & \ WORK.NAME$="Royal Straight" IF WORK.VALUE%=12% & \ WORK.NAME$="Straight Flush" IF WORK.VALUE%=13% & \ WORK.NAME$="Four of a kind" IF WORK.VALUE%=14% & \ WORK.NAME$="Royal Straight Flush" IF WORK.VALUE%=15% & \ RETURN 05000 ! ! ! Trade in computer's cards ! ! & \ MESSAGE$="Dealer trades in "+NUM1$(DEALER.TRADE%)+ & " cards ..." & \ MESSAGE$="Dealer trades in 1 card ..." IF DEALER.TRADE%=1%& \ DUMMY%=FNVM.DSPLY%(MESSAGE$) & \ FOR X%=1% TO 5% & \ DEALER.CARD%=DEALER.CARD(X%) & \ DEALER.CARD(X%)=DECK(DECK.CNT%+1%) IF DEALER.CARD%=0 & \ DECK.CNT%=DECK.CNT%+1% IF DEALER.CARD%=0 & \ NEXT X% & \ RETURN 05500 ! ! ! Display Updates Amounts ! ! & \ DUMMY%=FNVT.ONUM%(5%,12%,PLAYER.BANK,"###,###") & \ DUMMY%=FNVT.ONUM%(5%,36%,POT.AMT,"###,###") & \ DUMMY%=FNVT.ONUM%(5%,61%,DEALER.BANK,"###,###") & \ RETURN 06000 ! ! ! Display dealer's cards for comparison ! ! & \ DUMMY%=FNVT.OSTR%(7%,6%,DBL.TOP$+GRAPHIC$+REVCURS$+ & "lqqqqqklqqqqqklqqqqqklqqqqqklqqqqqk") & \ DUMMY%=FNVT.OSTR%(8%,6%,DBL.TOP$+"x xx xx"+ & " xx xx x") & \ DUMMY%=FNVT.OSTR%(9%,6%,DBL.BOT$+"x xx xx"+ & " xx xx x") & \ DUMMY%=FNVT.OSTR%(10%,6%,DBL.TOP$+"x xx xx"+ & " xx xx x") & \ FOR COL%=11% TO 16% & \ DUMMY%=FNVT.OSTR%(COL%,38%," x") & \ NEXT COL% & \ DUMMY%=FNVT.OSTR%(17%,38%,"qqj") & ! ! ! Display first (left most) Card Graphics ! ! & \ CARD.NAME$=CARD.VALUE$(HOLD.CARD(1%)) & \ GOSUB 1600 & \ DUMMY%=FNVT.OSTR%(8%,7%,CARD.NUM$+CARD.CHAR.1$) & \ DUMMY%=FNVT.OSTR%(9%,7%,CARD.NUM$+CARD.CHAR.2$) & ! ! ! Display second Card Graphics ! ! & \ CARD.NAME$=CARD.VALUE$(HOLD.CARD(2%)) & \ GOSUB 1600 & \ DUMMY%=FNVT.OSTR%(8%,14%,CARD.NUM$+CARD.CHAR.1$) & \ DUMMY%=FNVT.OSTR%(9%,14%,CARD.NUM$+CARD.CHAR.2$) & ! ! ! Display third Card Graphics ! ! & \ CARD.NAME$=CARD.VALUE$(HOLD.CARD(3%)) & \ GOSUB 1600 & \ DUMMY%=FNVT.OSTR%(8%,21%,CARD.NUM$+CARD.CHAR.1$) & \ DUMMY%=FNVT.OSTR%(9%,21%,CARD.NUM$+CARD.CHAR.2$) & ! ! ! Display fourth Card Graphics ! ! & \ CARD.NAME$=CARD.VALUE$(HOLD.CARD(4%)) & \ GOSUB 1600 & \ DUMMY%=FNVT.OSTR%(8%,28%,CARD.NUM$+CARD.CHAR.1$) & \ DUMMY%=FNVT.OSTR%(9%,28%,CARD.NUM$+CARD.CHAR.2$) & ! ! ! Display fifth Card Graphics ! ! & \ CARD.NAME$=CARD.VALUE$(HOLD.CARD(5%)) & \ GOSUB 1600 & \ DUMMY%=FNVT.OSTR%(8%,35%,CARD.NUM$+CARD.CHAR.1$) & \ DUMMY%=FNVT.OSTR%(9%,35%,CARD.NUM$+CARD.CHAR.2$) & \ CARD.NUM$=LEFT(CARD.NUM$,2%) IF LEN(CARD.NUM$)=3% & \ DUMMY%=FNVT.OSTR%(15%,38%,CARD.NUM$+CARD.CHAR.1$) & \ DUMMY%=FNVT.OSTR%(16%,38%,CARD.NUM$+CARD.CHAR.2$) & \ PRINT NRMCURS$; ! Back from reverse curs& \ RETURN 09000 ! ! ! Error Trap Routine ! ! & \ ERR.NO%=ERR ! Save error number & \ ERR.LINE%=ERL ! Save error line & \ ERR.MSG$=ERT$(ERR.NO%) ! Save error message & \ RESUME IF ERR.NO%=51% ! Improper Numeric & \ RESUME 32600 ! Report error/terminate 20000 ! ! ! Video Functions - VT100 ! ! & \ DEF* FNVT.INIT% & \ GOSUB 32100 ! Define XLT.ALL$ & \ GOSUB 32160 ! Define XLT.NUM$ & \ HOME$=CHR$(27%)+"[1;1H" ! Position cursor home & \ DBL.TOP$=CHR$(27%)+"#3" & \ DBL.BOT$=CHR$(27%)+"#4" & \ GRAPHIC$=CHR$(27%)+"(0" & \ NORMALC$=CHR$(27%)+"(B" & \ REVCURS$=CHR$(27%)+"[7m" & \ NRMCURS$=CHR$(27%)+"[0m" & \ GC$=CHR$(27%)+"(0" ! Graphics characters & \ KM$=CHR$(27%)+"(B" ! Ascii character set & \ VT.BLK%=0% & \ FNEND 20100 ! ! ! Erase to end of screen ! ! & \ DEF* FNVT.EEOS%(VT.VERT%,VT.HORZ%) & \ PRINT CHR$(27%);"[";NUM1$(VT.VERT%);CHR$(59%); & NUM1$(VT.HORZ%);"H";CHR$(27%);"[0J"; & \ FNEND 20200 ! ! ! Erase Charaters in line ! ! & \ DEF* FNVT.ECHR%(VT.VERT%,VT.HORZ%,VT.NUMCHAR%) & \ PRINT CHR$(27%);"[";NUM1$(VT.VERT%);CHR$(59%); & NUM1$(VT.HORZ%);"H";STRING$(VT.NUMCHAR%,32%) & \ FNEND 20300 ! ! ! Erase to End of Line ! ! & \ DEF* FNVT.EEOL%(VT.VERT%,VT.HORZ%) & \ PRINT CHR$(27%);"[";NUM1$(VT.VERT%);CHR$(59%); & NUM1$(VT.HORZ%);"H";CHR$(27%);"[0K"; & \ FNEND 20400 ! ! ! Output String ! ! & \ DEF* FNVT.OSTR%(VT.VERT%,VT.HORZ%,VT.STRING$) & \ PRINT CHR$(27%);"[";NUM1$(VT.VERT%);CHR$(59%); & NUM1$(VT.HORZ%);"H";VT.STRING$; & \ FNEND 20500 ! ! ! Output Formatted Numeric ! ! & \ DEF* FNVT.ONUM%(VT.VERT%,VT.HORZ%,VT.NUMBER,VT.FORM$) & \ PRINT CHR$(27%);"[";NUM1$(VT.VERT%);CHR$(59%); & NUM1$(VT.HORZ%);"H"; & \ PRINT USING VT.FORM$, VT.NUMBER & \ FNEND 20600 ! ! ! Input Numeric String ! ! & \ DEF* FNVT.INUM$(VT.PROMPT$) 20625 PRINT CHR$(27%);"[1";CHR$(59%);"1H";VT.PROMPT$;" "; & CHR$(27%);"[0K"; & \ IF VT.BLK%>0% THEN & PRINT " ";GC$;STRING$(VT.BLK%,115%);KM$; & \ PRINT CHR$(27%);"[1";CHR$(59%); & NUM1$(LEN(VT.PROMPT$)+2);"H"; & \ VT.BLK%=0% 20650 LINPUT VT.STRING$ & \ VT.STR$=XLATE(VT.STRING$,XLT.NUM$) & \ GOTO 20625 IF VT.STR$<>VT.STRING$ & \ FNVT.INUM$=VT.STR$ & \ FNEND 20700 ! ! ! Input Character String ! ! & \ DEF* FNVT.ISTR$(VT.PROMPT$) 20725 PRINT CHR$(27%);"[1";CHR$(59%);"1H";VT.PROMPT$;" "; & CHR$(27%);"[0K"; & \ IF VT.BLK%>0% THEN & PRINT " ";GC$;STRING$(VT.BLK%,115%);KM$; & \ PRINT CHR$(27%);"[1;";NUM1$(LEN(VT.PROMPT$)+2);"H";& \ VT.BLK%=0% 20750 LINPUT VT.STRING$ & \ VT.STR$=XLATE(VT.STRING$,XLT.ALL$) & \ GOTO 20725 IF VT.STR$<>VT.STRING$ & \ FNVT.ISTR$=VT.STR$ & \ FNEND 20800 ! ! ! Define Message display function ! ! & \ DEF* FNVM.DSPLY%(VT.MESSAGE$) & \ PRINT CHR$(27%);"[2;1H";CHR$(27%);"[0K" & \ PRINT CHR$(27%);"[2;1H";CHR$(7%);VT.MESSAGE$ & \ SLEEP 3% & \ PRINT CHR$(27%);"[2;1H";CHR$(27%);"[0K" & \ FNEND 32100 ! ! ! Define Character Translator String ! ! & \ XLT.ALL$=STRING$(32%,0%)+" !"+CHR$(34%)+ & "#$%&'()*+,-./0123456789:;<=>?@"+ & "ABCDEFGHIJCLMNOPQRSTUVWXYZ[\]^_ "+ & "abcdefghijklmnopqrstuvwxyz" & \ RETURN 32160 ! ! ! Define Numeric Translator String ! ! & \ XLT.NUM$=STRING$(48%,0%)+"0123456789" & \ RETURN 32600 ! ! ! Report System Error ! ! & \ PRINT STRING$(2%,7%);"System Error #";ERR.NO%;" at line";& ERR.LINE%;" !!!" & \ PRINT CHR$(10%);ERR.MSG$ 32750 ! ! ! Terminate Program ! ! & \ END