Subject: Re: [TI994A] Re: READing DATA in XB

From: Owen Brand <[email-masked]>
Date: Fri, 26 Apr 2013 23:41:06 -0600

BTW....  I realize the code is not optimized.  :)

Sent from Huawei Mobile

owenbrand99er <[email-masked]> wrote:

>I'll try to post this code here... If you want to DL the file, I'll also
>post the link.... 
><http://atariage.com/forums/topic/210628-new-baseball-game-for-the-ti-99\
>4a/page__st__150#entry2743038> 
><http://atariage.com/forums/index.php?app=core&module=attach&section=att\
>ach&attach_id=288283> HERE
><http://atariage.com/forums/topic/210628-new-baseball-game-for-the-ti-99\
>4a/page__st__150#entry2743038>
>***Looking at the code in this eMail, I'm not sure if it's going to be
>properly formatted either... The code is so format sensitive now with
>the adjustments I've made for PRINT statements.  We'll see.  The link
>takes you straight to the download if you're an AA member.  If not, and
>you want to try it out (assuming the copy and paste isn't perfect from
>here), I'll be happy to eMail it to you directly.
>
>Owen
>
>
>**REM THESE LINES SET UP INITIAL VARIABLES.  EACH BASE HAS A FLAG AND
>PLAYER NAME ASSOCIATED WITH IT10 DIM SCO(2), P$(2), C$(2), B$(2),
>BB$(2), BBB$(2), SS$(2), LF$(2), CF$(2), RF$(2), BO(2), HIT(2), WH(2)20
>DIM PBSC(2), PSC(2), CSC(2), BSC(2), BBSC(2), BBBSC(2), SSSC(2),
>LFSC(2), CFSC(2), RFSC(2)100 BAP=0 :: INN=1 :: OUT=3 :: BFLG=0 ::
>BBFLG=0 :: BBBFLG=0 :: HPFLG=0 :: SCO(1)=0 :: SCO(2)=0 :: TAP=1 :: INF=0
>:: RFLG=0105 BO(1)=0 :: BO(2)=0 :: HIT(1)=0 :: HIT(2)=0110 RANDOMIZE120
>REM BASEBALL SIM
>**REM THESE ARE THE STRING VARIABLES CARRYING THE PLAYERS' NAMES WITH
>THEM
>***REM HOME TEAM130 P$(1)="W. JOHNSON" :: PBSC(1)=450 :: PSC(1)=939135
>C$(1)="J. BENCH" :: CSC(1)=818140 B$(1)="L. GEHRIG" :: BSC(1)=990145
>BB$(1)="R. HORNSBY" :: BBSC(1)=995150 BBB$(1)="E. MATHEWS" ::
>BBBSC(1)=885155 SS$(1)="H. WAGNER" :: SSSC(1)=857160 LF$(1)="T.
>WILLIAMS" :: LFSC(1)=995165 CF$(1)="J. DIMAGGIO" :: CFSC(1)=997170
>RF$(1)="B. RUTH" :: RFSC(1)=1000
>***REM AWAY TEAM
>175 P$(2)="NOLAN RYAN" :: PBSC(2)=300 :: PSC(2)=853180 C$(2)="Y. BERRA"
>:: CSC(2)=830185 B$(2)="T. HELTON :: BSC(2)=962190 BB$(2)="R. CAREW" ::
>BBSC(2)=822195 BBB$(2)="A. RODRIGUEZ" :: BBBSC(2)=944200 SS$(2)="C.
>RIPKEN JR." :: SSSC(2)=788205 LF$(2)="B. WILLIAMS" :: LFSC(2)=858210
>CF$(2)="P. ROSE" :: CFSC(2)=784215 RF$(2)="M. CUDDYER" :: RFSC(2)=798
>
>220 CALL CL
>**REM BEGIN GAME LOOP
>240 IF OUT>2 THEN GOSUB 1200241 IF INN>8 THEN GOSUB 1600245 GOSUB 520
>
>
>
>***SCREEN DISPLAY248 IF INF=1 THEN CALL C("                    TOP")
>ELSE CALL C("                    BOT")250 CALL C(" OUTS: "&STR$(OUT)&"
>INNING: "&STR$(INN))251 CALL C(""):: CALL C("")252 CALL C(" HOME:
>"&STR$(SCO(1)))253 CALL C(" AWAY: "&STR$(SCO(2)))254 FOR I=1 TO 4 ::
>CALL C("") :: NEXT I255 TAP=TAP XOR 3256 CALL C("NOW PITCHING:"):: CALL
>C(P$(TAP)):: CALL C("")257 TAP=TAP XOR 3259 CALL C("NOW BATTING:")::
>CALL C(BAP$)260 CALL C("                 "&STR$(BBFLG))261 CALL C("
>"&STR$(BBBFLG)&" "&STR$(BFLG))262 CALL C("                
>"&STR$(BAP)):: CALL C("")
>MAIN LOOP
>280 GOSUB 1800 !This sends program control to the batter/pitcher matchup
>SUB320 CALL CL340 IF SFDICE=1 THEN GOSUB 360 ELSE GOSUB 440 !If "reach
>base," gosub 360, if "out" gosub 440350 FOR I=1 TO 900 :: NEXT I :: CALL
>CL :: GOTO 240
>
>
>**********************************************************REM THIS IS
>THE "YOU REACH BASE AND HERE'S HOW" SUB
>360 CALL CL370 ON WHDICE GOSUB 380,390,400,410,420,430 :: RETURN
>**REM WALK, RUNNERS ON BASE ADVANCE ONLY IF FORCED
>380 CALL C("WALK")381 IF BBBFLG>0 AND BBFLG>0 AND BFLG>0 THEN
>HPFLG=BBBFLG :: SCO(TAP)=SCO(TAP)+1 :: BBBFLG=BBFLG :: BBFLG=BFLG ::
>BFLG=BAP;382 IF BBFLG>0 AND BFLG>0 THEN BBBFLG=BBFLG :: BBFLG=BFLG ::
>BFLG=BAP383 IF BFLG>0 THEN BBFLG=BFLG :: BFLG=BAP384 BFLG=BAP385 RETURN
>**REM SINGLE, ALL RUNNERS ADVANCE ONE BASE
>390 CALL C("SINGLE") :: IF BBBFLG>0 THEN HPFLG=BBBFLG ::
>SCO(TAP)=SCO(TAP)+1 :: BBBFLG=0391 IF BBFLG>0 THEN BBBFLG=BBFLG ::
>BBFLG=0392 IF BFLG>0 THEN BBFLG=BFLG :: BFLG=0393 BFLG=BAP394 RETURN
>400 CALL C("SINGLE") :: IF BBBFLG>0 THEN HPFLG=BBBFLG ::
>SCO(TAP)=SCO(TAP)+1 :: BBBFLG=0401 IF BBFLG>0 THEN BBBFLG=BBFLG ::
>BBFLG=0402 IF BFLG>0 THEN BBFLG=BFLG :: BFLG=0403 BFLG=BAP404 RETURN
>**REM DOUBLE, ALL RUNNERS ADVANCE TWO BASES
>410 CALL C("DOUBLE") :: IF BBBFLG>0 THEN HPFLG=BBBFLG ::
>SCO(TAP)=SCO(TAP)+1 :: BBBFLG=0411 IF BBFLG>0 THEN HPFLG=BBFLG ::
>SCO(TAP)=SCO(TAP)+1 :: BBFLG=0412 IF BFLG>0 THEN BBBFLG=BFLG :: BFLG=0
>413 BBFLG=BAP414 RETURN
>**REM TRIPLE, ALL RUNNERS ADVANCE THREE BASES
>420 CALL C("TRIPLE") :: IF BBBFLG>0 THEN HPFLG=BBBFLG ::
>SCO(TAP)=SCO(TAP)+1 :: BBBFLG=0421 IF BBFLG>0 THEN HPFLG=BBFLG ::
>SCO(TAP)=SCO(TAP)+1 :: BBFLG=0422 IF BFLG>0 THEN HPFLG=BFLG ::
>SCO(TAP)=SCO(TAP)+1 :: BFLG=0423 BBBFLG=BAP424 RETURN
>**REM HOME RUN, ALL RUNNERS (PLUS BATTER AT PLATE) SCORE
>430 CALL C("HOME RUN") :: IF BBBFLG>0 THEN HPFLG=BBBFLG ::
>SCO(TAP)=SCO(TAP)+1 :: BBBFLG=0431 IF BBFLG>0 THEN HPFLG=BBFLG ::
>SCO(TAP)=SCO(TAP)+1 :: BBFLG=0432 IF BFLG>0 THEN HPFLG=BFLG ::
>SCO(TAP)=SCO(TAP)+1 :: BFLG=0433 HPFLG=BAP :: SCO(TAP)=SCO(TAP)+1434
>RETURN
>*************************************************************
>**REM THIS IS THE "YOU'RE OUT, AND HERE'S HOW" SUB
>440 CALL CL450 ON WHDICE GOSUB 490,470,480,500,510,460 :: RETURN
>**REM STRIKEOUT, NO RUNNERS ADVANCE460 CALL C("STRIKEOUT") :: OUT=OUT+1
>:: RETURN
>**REM GROUNDOUT, ALL RUNNERS ADVANCE A BASE
>470 CALL C("GROUNDOUT")471 OUT=OUT+1 :: IF OUT>2 THEN RETURN472 GOSUB
>1500 :: IF RFLG>0 THEN CALL C("ALL RUNNERS ADVANCE")474 IF BBBFLG>0 THEN
>HPFLG=BBBFLG :: SCO(TAP)=SCO(TAP)+1 :: BBBFLG=0475 IF BBFLG>0 THEN
>BBBFLG=BBFLG :: BBFLG=0476 IF BFLG>0 THEN BBFLG=BFLG :: BFLG=0477 RETURN
>**REM GROUNDOUT, RUNNERS ADVANCE IF FORCED
>480 CALL C("GROUNDOUT")481 OUT=OUT+1 :: IF OUT>2 THEN RETURN482 GOSUB
>1500 :: IF RFLG>0 THEN CALL C("RUNNERS ADVANCE IF FORCED")484 IF
>BBBFLG>0 AND BBFLG>0 AND BFLG>0 THEN HPFLG=BBBFLG :: SCO(TAP)=SCO(TAP)+1
>:: BBBFLG=BBFLG :: BBFLG=BFLG :: BFLG=0 :: RETURN485 IF BBFLG>0 AND
>BFLG>0 THEN BBBFLG=BBFLG :: BBFLG=BFLG :: BFLG=0 :: RETURN486 IF BFLG>0
>THEN BBFLG=BFLG :: BFLG=0487 RETURN
>**REM GROUNDOUT, DOUBLE PLAY IF RUNNER ON 1ST AND LESS THAN 2 OUTS, ALL
>OTHERS ADVANCE
>490 CALL C("GROUNDOUT")491 OUT=OUT+1 :: IF OUT>2 THEN RETURN495 IF
>BFLG>0 THEN OUT=OUT+1 :: BFLG=0 :: CALL C("DOUBLE PLAY!") :: IF OUT>2
>THEN RETURN496 IF BBBFLG>0 THEN HPFLG=BBBFLG :: SCO(TAP)=SCO(TAP)+1 ::
>BBBFLG=0497 IF BBFLG>0 THEN BBBFLG=BBFLG :: BBFLG=0498 GOSUB 1500 :: IF
>RFLG>0 THEN CALL C("RUNNERS ADVANCE")499 RETURN
>**REM SHALLOW FLYOUT.  NO RUNNERS ADVANCE
>500 CALL C("SHALLOW FLYOUT")506 OUT=OUT+1 :: IF OUT>2 THEN RETURN507
>GOSUB 1500 :: IF RFLG>0 THEN CALL C("RUNNERS HOLD")508 RETURN
>**REM DEEP FLYOUT.  ONLY RUNNERS ON 2ND AND 3RD ADVANCE
>510 CALL C("DEEP FLYOUT")511 OUT=OUT+1 :: IF OUT>2 THEN RETURN515 GOSUB
>1500 :: IF RFLG>0 THEN CALL C("RUNNERS ON SECOND OR THIRD  ADVANCE")516
>IF BBBFLG>0 THEN HPFLG=BBBFLG :: SCO(TAP)=SCO(TAP)+1 :: BBBFLG=0517 IF
>BBFLG>0 THEN BBBFLG=BBFLG :: BBFLG=0518 RETURN
>
>
>************************************************************************\
>***
>**REM THIS IS THE "GO THROUGH BATTING ORDER AND DISPLAY BATTER'S NAME"
>SUB
>520 BAP=BAP+1521 IF BAP>9 THEN BAP=1530 IF BAP=1 THEN BAP$=B$(TAP)::
>BAPSC=BSC(TAP)531 IF BAP=2 THEN BAP$=BB$(TAP):: BAPSC=BBSC(TAP)535 IF
>BAP=3 THEN BAP$=BBB$(TAP):: BAPSC=BBBSC(TAP)536 IF BAP=4 THEN
>BAP$=SS$(TAP):: BAPSC=SSSC(TAP)540 IF BAP=5 THEN BAP$=LF$(TAP)::
>BAPSC=LFSC(TAP)541 IF BAP=6 THEN BAP$=CF$(TAP):: BAPSC=CFSC(TAP)545 IF
>BAP=7 THEN BAP$=RF$(TAP):: BAPSC=RFSC(TAP)546 IF BAP=8 THEN
>BAP$=C$(TAP):: BAPSC=CSC(TAP)550 IF BAP=9 THEN BAP$=P$(TAP)::
>BAPSC=PBSC(TAP)551 TAP=TAP XOR 3552 POM=PSC(TAP)553 TAP=TAP XOR 3560
>RETURN
>
>************************************************************************\
>***
>**REM THIS IS THE "3 OUTS, NOW CHANGE SIDES" SUB
>
>1200 INF=INF+1 :: GOSUB 1600 :: CALL CL1210 IF INF>2 THEN INF=1 ::
>INN=INN+11215 CALL C("         INNING #"&STR$(INN)) :: FOR I=1 TO 10 ::
>CALL C(""):: NEXT I :: FOR I=1 TO 500 :: NEXT I1220 IF INF=2 THEN CALL
>C("     HOME TEAM UP TO BAT")1250 IF INF=1 THEN CALL C("     AWAY TEAM
>UP TO BAT")1260 FOR I=1 TO 10 :: CALL C(""):: NEXT I1264 FOR I=1 TO 500
>:: NEXT I1265 BO(TAP)=BAP1266 TAP=TAP XOR 31267 BAP=BO(TAP)1268 OUT=0 ::
>BFLG=0 :: BBFLG=0 :: BBBFLG=01269 CALL CL1270 RETURN
>
>************************************************************************\
>***
>**REM THIS IS THE "CHECK IF THERE ARE ANY BASE RUNNERS" SUB
>1500 IF BFLG>0 THEN RFLG=1 :: RETURN1510 IF BBFLG>0 THEN RFLG=1 ::
>RETURN1520 IF BBBFLG>0 THEN RFLG=1 :: RETURN1530 RFLG=0 :: RETURN
>************************************************************************\
>***
>**REM THIS IS THE "CHECK FOR A TIE AT THE END OF THE GAME" SUB
>1600 IF SCO(1)=SCO(2) THEN RETURN1605 IF INN>8 THEN GOSUB 17001610
>RETURN
>************************************************************************\
>***
>**REM THIS IS THE "END THE GAME IF IT'S THE BOTTOM OF THE LAST INNING"
>SUB (AND WALKOFF)
>1700 IF INF=1 THEN RETURN1705 IF SCO(1)>SCO(2) THEN CALL CL :: CALL
>C("GAME OVER")1706 CALL C("HOME: "&STR$(SCO(1))) :: CALL C("AWAY:
>"&STR$(SCO(2))) :: END1708 IF SCO(1)<SCO(2) THEN CALL CL :: CALL C("GAME
>OVER")1709 CALL C("HOME: "&STR$(SCO(1))) :: CALL C("AWAY:
>"&STR$(SCO(2))) :: END1710 RETURN
>
>
>************************************************************************\
>***
>**REM BATTER/PITCHER MATCHUP SUB
>
>1800 BCH=INT(RND*BAPSC)+1 :: PCH=INT(RND*POM)+1 !Batter vs. hitter
>matchup based on score1805 IF BCH>PCH THEN SFDICE=1 ELSE SFDICE=2 !If
>the batter wins, SFDICE is 1, otherwise, 21810 WHDICE=INT(RND*6)+11811
>IF TAP=1 THEN 1812 ELSE 18151812 CALL C("1) AGGRESSIVE HITTING?"):: CALL
>C("2) CAUTIOUS HITTING?"):: GOTO 18201815 CALL C("1) AGGRESSIVE
>PITCHING?"):: CALL C("2) CAUTIOUS PITCHING?")1820 !REM CALL KEY FOR 1 or
>2--- this will help determine the outcome of the at-bat1825 CALL
>KEY(0,K,S):: IF S=0 THEN 18201830 IF K<49 THEN 1820 ELSE IF K>50 THEN
>1820 !!!1840 K=K-48 :: IF K=1 THEN 1850 ELSE 1880 !If 1 is pressed,
>continue with program, else goto 18801850 WHDICE=WHDICE+2 :: IF WHDICE>6
>THEN WHDICE=6 :: GOTO 1890 !aggressive play, increase big result1880
>WHDICE=WHDICE-2 :: IF WHDICE<1 THEN WHDICE=1 !cautious play, decrease
>big result1890 RETURN
>**1885 for
>test********************************************************************\
>*******
>**REM -BBS SPECIFIC "PRINT" CALL
>2000 SUB C(A$):: PRINT A$ :: SUBEND
>************************************************************************\
>***
>**REM -BBS SPECIFIC "CALL CLEAR"
>3000 SUB CL :: CALL CLEAR :: SUBEND