Opry99er Posted April 1, 2013 Author Share Posted April 1, 2013 Thanks guys... I appreciate the further explanation. =) @sometimes99er: You a baseball guy? I know some places in the world, the game hasn't really become a national pastime... @Tursi: It's been quite a while since I've tried, but I'm assuming that with all the great updates to Classic99, I can now use the ToD editor, read and write functionalities? =) Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted April 1, 2013 Share Posted April 1, 2013 Nope, know of the game, but otherwise close to nothing. In Denmark we don't play Baseball or Cricket for that matter. We do play Longball, but only for a bit of fun in the street, at school or summer camp. Quote Link to comment Share on other sites More sharing options...
Opry99er Posted April 1, 2013 Author Share Posted April 1, 2013 Hmmm... it's a cousin of baseball for sure... I would say it is probably more like Townball than baseball, but still in the same family of games. It really is a marvelous game, baseball... To truly experience it you must go to a ballfield and enjoy a beverage or common ballfield food-fare and take in the sights, sounds, and smells... A very wonderfiul game... Quote Link to comment Share on other sites More sharing options...
unhuman Posted April 1, 2013 Share Posted April 1, 2013 Oooh!!!! Welcome back Owen! Quote Link to comment Share on other sites More sharing options...
Opry99er Posted April 1, 2013 Author Share Posted April 1, 2013 Hey, thanks Howie!!! =) Glad to see you're still here, man. It's most definitely a blessing to see all of my friends still active and rockin! So many excellent things have transpired since I went to live in Tennessee!!! The SIDcard, falcon's XB compiler, games galore... I have an incredible amount of catching up to do!!! But first... baseball..... Quote Link to comment Share on other sites More sharing options...
unhuman Posted April 1, 2013 Share Posted April 1, 2013 Yeah, I've been here. Drooling over the XB compiler and watching its developments... Real work has gotten in the way, though, but that'll be something you'll absolutely love (if you've got an iPad).... -H Quote Link to comment Share on other sites More sharing options...
Opry99er Posted April 1, 2013 Author Share Posted April 1, 2013 an iPad? Quote Link to comment Share on other sites More sharing options...
Opry99er Posted April 1, 2013 Author Share Posted April 1, 2013 Need to carry a flag for each of the bases, but it won't be a simple T/F flag... it must also carry the name and information of the specific player who is on that base. Each at-bat will be recorded for each player. This one's proving a little trickier than the easy stuff I've done so far on this project... give me some time though... I'll get it done. =) Quote Link to comment Share on other sites More sharing options...
Tursi Posted April 1, 2013 Share Posted April 1, 2013 @Tursi: It's been quite a while since I've tried, but I'm assuming that with all the great updates to Classic99, I can now use the ToD editor, read and write functionalities? =) Nope, probably not! Still can't write to disk images, and I suspect that was the problem in the past. Sector writes work, though, TI Forth needed that. Quote Link to comment Share on other sites More sharing options...
Opry99er Posted April 2, 2013 Author Share Posted April 2, 2013 I wonder what would have to be done to the code to allow for either sector writes or FIAD access to the Editor..... Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted April 2, 2013 Share Posted April 2, 2013 I wonder what would have to be done to the code to allow for either sector writes or FIAD access to the Editor..... I am not familiar with ToD. Is there source available? ...lee Quote Link to comment Share on other sites More sharing options...
Opry99er Posted April 2, 2013 Author Share Posted April 2, 2013 I think there is some floating around. At one point we were looking pretty hard into the ToD Editor and the origins... A couple years ago I could have told you who wrote it, when it was written, why, and using what hardware. Now....... I'd like to get the editor to work in emulation, but as of now I can only run it on hardware. Quote Link to comment Share on other sites More sharing options...
Opry99er Posted April 2, 2013 Author Share Posted April 2, 2013 Codex once hacked all the hex code and could do some editing that way, but I don't think we ever found any way to run the Editor in emulation. Maybe PC99 or Mess could run it... But I use Classic99 exclusively Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted April 2, 2013 Share Posted April 2, 2013 Codex once hacked all the hex code and could do some editing that way, but I don't think we ever found any way to run the Editor in emulation. Maybe PC99 or Mess could run it... But I use Classic99 exclusively You can't use the FIAD mode on Classic99? ...lee Quote Link to comment Share on other sites More sharing options...
Opry99er Posted April 2, 2013 Author Share Posted April 2, 2013 Unfortunately no... at least I couldnt a couple years ago... something about how the editor writes to the disk. HOWEVER... Now that sector writes are supported, that may solve the issues. I don't know when sector writes were implemented into Classic99. Quote Link to comment Share on other sites More sharing options...
Opry99er Posted April 2, 2013 Author Share Posted April 2, 2013 Guess I could try it again. =) Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted April 2, 2013 Share Posted April 2, 2013 Unfortunately no... at least I couldnt a couple years ago... something about how the editor writes to the disk. HOWEVER... Now that sector writes are supported, that may solve the issues. I don't know when sector writes were implemented into Classic99. I was the one pushing him to do sector writes. He implemented them in mid-January here. ...lee Quote Link to comment Share on other sites More sharing options...
Opry99er Posted April 3, 2013 Author Share Posted April 3, 2013 (edited) So the base running engine is proving to be a bit more difficult than I had originally anticipated. Here's the general logic... 8 different base running scenarios: 1) nobody on base 2) man on first 3) man on second 4) man on third 5) men on first and second 6) men on second and third 7) men on first and third 8 ) bases loadad 5 scenarios at the plate (if there is success) 1) walk 2) single 3) double 4) triple 5) home run 6 scenarios at the plate (if there is no success) 1) strike out 2) ground out (all runners advance) 3) ground out (runners advance if forced) 4) ground out (double play if 1st base is occupied and there are less than 2 outs) 5) shallow fly-out (all runners hold) 6) deep fly out (runners on 2nd and 3rd base advance) Now, the program is already tracking who is up to bat and how many outs have been recorded. For each at bat, the roll of the two dice determines success or failure and then what is supposed to happen to the batter at the plate. All this is already in place and operational. It's what happens after that that is the kicker. Once a player is on base, how do we track him, what do we do when another hitter has an at bat and it affects the base-runner's status and position on the base path... Yea, it's a bit more complex than I'd though. =) But that's okay! It's all part of the fun! Edited April 3, 2013 by Opry99er Quote Link to comment Share on other sites More sharing options...
Opry99er Posted April 3, 2013 Author Share Posted April 3, 2013 One method I'd considered was handling the code in this way. First of all, the flags for if a player is on a particular base are BFLG (flag for "player on first") BBFLG (flag for "player on second") BBBFLG (flag for "player on third") Second, the string variables which contain a player's name are as follows (it's redundant, actually, and pretty self-explanatory) B$=player's name who's on first BB$=player's name who's on second BBB$=player's name who's on third BAP$=player's name who is at the plate (BAP stands for "batter at plate") This is if the plate appearance is a success and the roll is a "single". 390 PRINT "SINGLE" :: IF BFLG=1 THEN BBFLG=1 :: BB$=B$ :: BAP$=B$ :: RETURN What this does is checks if a player is on first base (BFLG=1 or "true"). If so, then it changes the BBFLG to 1 (which means that the runner on first goes to second). Secondarily, it takes the name of the player on first and puts that player's name into the "name" slot for second base. (BB$=B$) Thirdly, it takes the player who just got the hit and puts his name at first base. (BAP$=B$) Now I need to figure out how to handle players on second and third... If I set BB$ to B$ and there's already a player on second, then that player's info gets lost and he can't be sent to third base. The other alternative is to do it all in reverse, but that only takes into account sequential base runners... If there's a player on first and third, it changes the dynamic entirely. ***So as you can see, there's a TON of stuff to take into consideration for a simple base-running engine. =) Quote Link to comment Share on other sites More sharing options...
Opry99er Posted April 3, 2013 Author Share Posted April 3, 2013 (edited) Current code (commented) without base running engine. This will serve as a reference point during development. REM THESE LINES SET UP INITIAL VARIABLES. EACH BASE HAS A FLAG AND PLAYER NAME ASSOCIATED WITH IT 100 BAP=0 :: INN=1 :: OUT=0 :: BFLG=0 :: BP$=" " :: BBFLG=0 ::BBP$=" " :: BBBFLG=0 :: BBBP$=" " 110 RANDOMIZE 120 REM BASEBALL SIM REM THESE ARE THE STRING VARIABLES CARRYING THE PLAYERS' NAMES WITH THEM 130 P$="W. JOHNSON" 140 C$="J. BENCH" 150 B$="L. GEHRIG" 160 BB$="R. HORNSBY" 170 BBB$="E. MATHEWS" 180 SS$="H. WAGNER" 190 LF$="T. WILLIAMS" 200 CF$="J. DIMAGGIO" 210 RF$="B. RUTH" 220 CALL CLEAR 230 DISPLAY AT(8,:"DICE BASEBALL"; REM OFFICIAL START OF GAME LOOP 240 DISPLAY AT(12,:"PRESS ANY KEY":" TO SIMULATE"; 250 GOSUB 520 260 IF OUT>2 THEN OUT=0 :: INN=INN+1 270 DISPLAY AT(4,4):"OUTS: ";OUT :: DISPLAY AT(4,18):"INNING: ";INN 280 DISPLAY AT(20,1):"NOW BATTING:":BAP$; 290 CALL KEY(0,K,S):: IF S=0 THEN 290 300 SFDICE=INT(RND*6)+1 310 WHDICE=INT(RND*6)+1 320 CALL CLEAR :: PRINT SFDICE :: PRINT WHDICE 330 FOR I=1 TO 400 :: NEXT I 340 IF SFDICE<3 THEN GOSUB 360 ELSE GOSUB 440 350 FOR I=1 TO 900 :: NEXT I :: CALL CLEAR :: GOTO 240 REM END OF GAME LOOP **REM START OF SUBROUTINES** REM THIS IS THE "YOU REACH BASE AND HERE'S HOW" SUB (CURRENTLY ADDING BASE RUNNING CODE) 360 CALL CLEAR 370 ON WHDICE GOSUB 380,390,400,410,420,430 :: RETURN 380 PRINT "WALK" :: RETURN 390 PRINT "SINGLE" :: RETURN 400 PRINT "SINGLE" :: RETURN 410 PRINT "DOUBLE" :: RETURN 420 PRINT "TRIPLE" :: RETURN 430 PRINT "HOME RUN" :: RETURN REM THIS IS THE "YOU'RE OUT, AND HERE'S HOW" SUB 440 CALL CLEAR 450 ON WHDICE GOSUB 460,470,480,490,500,510 :: RETURN 460 PRINT "STRIKEOUT" :: OUT=OUT+1 :: RETURN 470 PRINT "GROUNDOUT, RUNNERS ADVANCE" :: OUT=OUT+1 :: RETURN 480 PRINT "GROUNDOUT, RUNNERS ADVANCE":"IF FORCED" :: OUT=OUT+1 :: RETURN 490 PRINT "GROUNDOUT, DOUBLE PLAY":"IF RUNNER ON 1ST AND":"LESS THAN 2 OUTS...":"ALL OTHERS ADVANCE" :: OUT=OUT+1 :: RETURN 500 PRINT "SHALLOW FLYOUT":"RUNNERS HOLD" :: OUT=OUT+1 :: RETURN 510 PRINT "DEEP FLYOUT, RUNNERS ON":"SECOND OR THIRD ADVANCE" :: OUT=OUT+1 :: RETURN REM THIS IS THE "GO THROUGH BATTING ORDER AND DISPLAY BATTER'S NAME" SUB 520 BAP=BAP+1 :: IF BAP>9 THEN BAP=1 530 IF BAP=1 THEN BAP$=B$ ELSE IF BAP=2 THEN BAP$=BB$ ELSE IF BAP=3 THEN BAP$=BBB$ ELSE IF BAP=4 THEN BAP$=SS$ 540 IF BAP=5 THEN BAP$=LF$ ELSE IF BAP=6 THEN BAP$=CF$ ELSE IF BAP=7 THEN BAP$=RF$ ELSE IF BAP=8 THEN BAP$=C$ 550 IF BAP=9 THEN BAP$=P$ 560 RETURN Edited April 3, 2013 by Opry99er Quote Link to comment Share on other sites More sharing options...
Opry99er Posted April 3, 2013 Author Share Posted April 3, 2013 (edited) http://s830.photobucket.com/user/Opry99er/media/Classic99_zps75ea1ce4.mp4.html As you can see, everything functions except for the score keeping and base running. At this point, it's just an exercise in simulation of "at-bats" accuracy. I'm working in some code right now that will allow for a more delicate handling of "who's on the bases." Rather than an 1 or 0 true/false flag for each base and a string variable for the names, each base will carry with it a number from 0-9. Zero being "empty base" and 1-9 being a specific batter in the lineup. When it calls for statistical scorekeeping per player, the player's name will be irrelevant. Only the number in the lineup order (1-9) will be relevant and the name of the player in a specific lineup spot will be associated with the number in the batting order he currently occupies. I handle it this way already in the "BAP" checks in the last subroutine (LINES 520-560) so why not be consistent throughout? 520 BAP=BAP+1 :: IF BAP>9 THEN BAP=1 530 IF BAP=1 THEN BAP$=B$ ELSE IF BAP=2 THEN BAP$=BB$ ELSE IF BAP=3 THEN BAP$=BBB$ ELSE IF BAP=4 THEN BAP$=SS$ 540 IF BAP=5 THEN BAP$=LF$ ELSE IF BAP=6 THEN BAP$=CF$ ELSE IF BAP=7 THEN BAP$=RF$ ELSE IF BAP=8 THEN BAP$=C$ 550 IF BAP=9 THEN BAP$=P$ 560 RETURN Edited April 3, 2013 by Opry99er Quote Link to comment Share on other sites More sharing options...
Opry99er Posted April 3, 2013 Author Share Posted April 3, 2013 (edited) Okay, this will take some tweaking, but here's a way to handle the base runners on ONE instance... A single. 390 PRINT "SINGLE" :: IF BBBFLG>0 THEN HPFLG=BBBFLG :: SCO=SCO+1 :: BBBFLG=0 391 IF BBFLG>0 THEN BBBFLG=BBFLG :: BBFLG=0 392 IF BFLG>0 THEN BBFLG=BFLG :: BFLG=0 393 BFLG=BAP 394 RETURN In this scenario, the (B)atter (A)t (P)late hits a single. In this case, all runners will advance one base. First I start by checking if third base is occupied... (IF BBBFLG>0 THEN HPFLG=BBBFLG :: SCO=SCO+1 :: BBBFLG=0) If third is occupied, that player's flag data gets sent to home plate (for a run scored). The 3rd base flag is then set to zero. Then I check if 2nd base is occupied (IF BBFLG....) and move THAT player to third (if he's there... sometimes there will be a man on third and not on second) Then I check first, and if there's a guy there, I send him to second. Since it was a single, LINE 393 moves the BAP to first base, setting that flag for his lineup number. ***Each instance of player motion is recorded and accounted for in this scenario. Next I will handle walks, doubles, and triples. Edited April 3, 2013 by Opry99er Quote Link to comment Share on other sites More sharing options...
Opry99er Posted April 3, 2013 Author Share Posted April 3, 2013 Okay, all but the "walk" roll is done. **Note that the code is not optimized, it is simply as readable as I can make it at this point. The code has been tested and works. Now I need to keep visual track of base runners on the display so that it is easy to know what is happening. Another adjustment I made is that at the end of an inning, all bases are cleared before the next inning starts. I just did a flag-clear in line 260 to accomplish this. Once I finish the "walk" routine, I'll resequence and repost the entire code so you can try it out. REM THIS IS THE "YOU REACH BASE AND HERE'S HOW" SUB 360 CALL CLEAR 370 ON WHDICE GOSUB 380,390,400,410,420,430 :: RETURN 380 PRINT "WALK" :: RETURN **REM SINGLE, ALL RUNNERS ADVANCE ONE BASE 390 PRINT "SINGLE" :: IF BBBFLG>0 THEN HPFLG=BBBFLG :: SCO=SCO+1 :: BBBFLG=0 391 IF BBFLG>0 THEN BBBFLG=BBFLG :: BBFLG=0 392 IF BFLG>0 THEN BBFLG=BFLG :: BFLG=0 393 BFLG=BAP 394 RETURN 400 PRINT "SINGLE" :: IF BBBFLG>0 THEN HPFLG=BBBFLG :: SCO=SCO+1 :: BBBFLG=0 401 IF BBFLG>0 THEN BBBFLG=BBFLG :: BBFLG=0 402 IF BFLG>0 THEN BBFLG=BFLG :: BFLG=0 403 BFLG=BAP 404 RETURN **REM DOUBLE, ALL RUNNERS ADVANCE TWO BASES 410 PRINT "DOUBLE" :: IF BBBFLG>0 THEN HPFLG=BBBFLG :: SCO=SCO+1 :: BBBFLG=0 411 IF BBFLG>0 THEN HPFLG=BBFLG :: SCO=SCO+1 :: BBFLG=0 412 IF BFLG>0 THEN BBBFLG=BFLG :: BFLG=0 413 BBFLG=BAP 414 RETURN **REM TRIPLE, ALL RUNNERS ADVANCE THREE BASES 420 PRINT "TRIPLE" :: IF BBBFLG>0 THEN HPFLG=BBBFLG :: SCO=SCO+1 :: BBBFLG=0 421 IF BBFLG>0 THEN HPFLG=BBFLG :: SCO=SCO+1 :: BBFLG=0 422 IF BFLG>0 THEN HPFLG=BFLG :: SCO=SCO+1 :: BFLG=0 423 BBBFLG=BAP 424 RETURN **REM HOME RUN, ALL RUNNERS (PLUS BATTER AT PLATE) SCORE 430 PRINT "HOME RUN" :: IF BBBFLG>0 THEN HPFLG=BBBFLG :: SCO=SCO+1 :: BBBFLG=0 431 IF BBFLG>0 THEN HPFLG=BBFLG :: SCO=SCO+1 :: BBFLG=0 432 IF BFLG>0 THEN HPFLG=BFLG :: SCO=SCO+1 :: BFLG=0 433 HPFLG=BAP :: SCO=SCO+1 434 RETURN Quote Link to comment Share on other sites More sharing options...
Opry99er Posted April 3, 2013 Author Share Posted April 3, 2013 Last post of the night. I now have ALL the "successful" plate appearances operational. Walk, Single, Double, Triple, and Homerun. You can simulate an entire 9 inning game and watch the score as you play. I still need to add the visual base-running bit... Unless you keep track in your head what bases are covered and what happens during a play, it's tough to know what's happening on the base path. I have tested four 9 inning games and they have all played properly. **Note. If an out occurs but runners are supposed to advance (like on a fly ball), they will currently NOT do that. Double plays ALSO do not take place yet. I haven't written any code for the "outs" rolls yet. If an out occurs, one (and only one) out will be recorded and no players will advance any bases. Tomorrow I will finish the "outs" simulation to include base advances, double plays, etc. Shouldn't be too hard now that I know what I'm doing. =) **REM THESE LINES SET UP INITIAL VARIABLES. EACH BASE HAS A FLAG AND PLAYER NAME ASSOCIATED WITH IT 100 BAP=0 :: INN=1 :: OUT=0 :: BFLG=0 :: BBFLG=0 :: BBBFLG=0 :: HPFLG=0 :: SCO=0 110 RANDOMIZE 120 REM BASEBALL SIM **REM THESE ARE THE STRING VARIABLES CARRYING THE PLAYERS' NAMES WITH THEM 130 P$="W. JOHNSON" 140 C$="J. BENCH" 150 B$="L. GEHRIG" 160 BB$="R. HORNSBY" 170 BBB$="E. MATHEWS" 180 SS$="H. WAGNER" 190 LF$="T. WILLIAMS" 200 CF$="J. DIMAGGIO" 210 RF$="B. RUTH" **REM THIS IS THE START OF THE VISUAL SETUP 220 CALL CLEAR 230 DISPLAY AT(8,:"DICE BASEBALL"; 240 DISPLAY AT(12,:"PRESS ANY KEY":" TO SIMULATE"; 250 GOSUB 520 260 IF OUT>2 THEN OUT=0 :: INN=INN+1 :: BFLG=0 :: BBFLG=0 :: BBBFLG=0 265 IF INN>9 THEN CALL CLEAR :: PRINT "GAME OVER" :: END 270 DISPLAY AT(4,4):"OUTS: ";OUT :: DISPLAY AT(4,18):"INNING: ";INN :: DISPLAY AT(6,4):"SCORE: ";SCO 280 DISPLAY AT(20,1):"NOW BATTING:":BAP$; 290 CALL KEY(0,K,S):: IF S=0 THEN 290 300 SFDICE=INT(RND*6)+1 310 WHDICE=INT(RND*6)+1 320 CALL CLEAR :: PRINT SFDICE :: PRINT WHDICE 330 FOR I=1 TO 400 :: NEXT I 340 IF SFDICE<3 THEN GOSUB 360 ELSE GOSUB 440 350 FOR I=1 TO 900 :: NEXT I :: CALL CLEAR :: GOTO 240 **REM THIS IS THE "YOU REACH BASE AND HERE'S HOW" SUB 360 CALL CLEAR 370 ON WHDICE GOSUB 380,390,400,410,420,430 :: RETURN **REM WALK, RUNNERS ON BASE ADVANCE ONLY IF FORCED 380 PRINT "WALK" 381 IF BBBFLG>0 AND BBFLG>0 AND BFLG>0 THEN HPFLG=BBBFLG :: SCO=SCO+1 :: BBBFLG=BBFLG :: BBFLG=BFLG :: BFLG=BAP 382 IF BBFLG>0 AND BFLG>0 THEN BBBFLG=BBFLG :: BBFLG=BFLG :: BFLG=BAP 383 IF BFLG>0 THEN BBFLG=BFLG :: BFLG=BAP 384 BFLG=BAP 385 RETURN **REM SINGLE, ALL RUNNERS ADVANCE ONE BASE 390 PRINT "SINGLE" :: IF BBBFLG>0 THEN HPFLG=BBBFLG :: SCO=SCO+1 :: BBBFLG=0 391 IF BBFLG>0 THEN BBBFLG=BBFLG :: BBFLG=0 392 IF BFLG>0 THEN BBFLG=BFLG :: BFLG=0 393 BFLG=BAP 394 RETURN 400 PRINT "SINGLE" :: IF BBBFLG>0 THEN HPFLG=BBBFLG :: SCO=SCO+1 :: BBBFLG=0 401 IF BBFLG>0 THEN BBBFLG=BBFLG :: BBFLG=0 402 IF BFLG>0 THEN BBFLG=BFLG :: BFLG=0 403 BFLG=BAP 404 RETURN **REM DOUBLE, ALL RUNNERS ADVANCE TWO BASES 410 PRINT "DOUBLE" :: IF BBBFLG>0 THEN HPFLG=BBBFLG :: SCO=SCO+1 :: BBBFLG=0 411 IF BBFLG>0 THEN HPFLG=BBFLG :: SCO=SCO+1 :: BBFLG=0 412 IF BFLG>0 THEN BBBFLG=BFLG :: BFLG=0 413 BBFLG=BAP 414 RETURN **REM TRIPLE, ALL RUNNERS ADVANCE THREE BASES 420 PRINT "TRIPLE" :: IF BBBFLG>0 THEN HPFLG=BBBFLG :: SCO=SCO+1 :: BBBFLG=0 421 IF BBFLG>0 THEN HPFLG=BBFLG :: SCO=SCO+1 :: BBFLG=0 422 IF BFLG>0 THEN HPFLG=BFLG :: SCO=SCO+1 :: BFLG=0 423 BBBFLG=BAP 424 RETURN **REM HOME RUN, ALL RUNNERS (PLUS BATTER AT PLATE) SCORE 430 PRINT "HOME RUN" :: IF BBBFLG>0 THEN HPFLG=BBBFLG :: SCO=SCO+1 :: BBBFLG=0 431 IF BBFLG>0 THEN HPFLG=BBFLG :: SCO=SCO+1 :: BBFLG=0 432 IF BFLG>0 THEN HPFLG=BFLG :: SCO=SCO+1 :: BFLG=0 433 HPFLG=BAP :: SCO=SCO+1 434 RETURN **REM THIS IS THE "YOU'RE OUT, AND HERE'S HOW" SUB 440 CALL CLEAR 450 ON WHDICE GOSUB 460,470,480,490,500,510 :: RETURN 460 PRINT "STRIKEOUT" :: OUT=OUT+1 :: RETURN 470 PRINT "GROUNDOUT, RUNNERS ADVANCE" :: OUT=OUT+1 :: RETURN 480 PRINT "GROUNDOUT, RUNNERS ADVANCE":"IF FORCED" :: OUT=OUT+1 :: RETURN 490 PRINT "GROUNDOUT, DOUBLE PLAY":"IF RUNNER ON 1ST AND":"LESS THAN 2 OUTS...":"ALL OTHERS ADVANCE" :: OUT=OUT+1 :: RETURN 500 PRINT "SHALLOW FLYOUT":"RUNNERS HOLD" :: OUT=OUT+1 :: RETURN 510 PRINT "DEEP FLYOUT, RUNNERS ON":"SECOND OR THIRD ADVANCE" :: OUT=OUT+1 :: RETURN **REM THIS IS THE "GO THROUGH BATTING ORDER AND DISPLAY BATTER'S NAME" SUB 520 BAP=BAP+1 :: IF BAP>9 THEN BAP=1 530 IF BAP=1 THEN BAP$=B$ ELSE IF BAP=2 THEN BAP$=BB$ ELSE IF BAP=3 THEN BAP$=BBB$ ELSE IF BAP=4 THEN BAP$=SS$ 540 IF BAP=5 THEN BAP$=LF$ ELSE IF BAP=6 THEN BAP$=CF$ ELSE IF BAP=7 THEN BAP$=RF$ ELSE IF BAP=8 THEN BAP$=C$ 550 IF BAP=9 THEN BAP$=P$ 560 RETURN Quote Link to comment Share on other sites More sharing options...
jacquesg Posted April 3, 2013 Share Posted April 3, 2013 (edited) Owen, I have not been following your game development that closely but it seems to me that you could also use bits as flags. The Craig Miller Night Mission book has a chapter on 'The Power of AND'. Here is a quick overview: SET A FLAG F=F OR 4 turns on bit 2 TEST A FLAG Single flag IF F AND 4 THEN ... bit 2 is ON Multiple flags IF F AND 6 = 6 THEN ... (both bits 1 and 2 are ON) ELSE... (one or none are set) IF F AND 6 THEN... (both or either are set) ELSE ... (neither is set) DELETE a FLAG F = F AND NOT 4 turns off bit 2 or F = F AND 251 turns off bit 2 or F = F AND -5 turns off bit 2 TOGGLE a FLAG F = F XOR 4 toggle bit 2 The main advantage is that you can cut down on the number of variables used but the big disavantage is that you MUST manually keep track of how the various bits in each variable are being used. There is also a Home Computer tech note in Vol 5 No. 6 of 99'er magazine entitled 'Several flags in one variable'. Have fun, Jacques Edited April 3, 2013 by jacquesg Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.