Jump to content

Photo

Tho Oregon Trail for TI-99/4

1978 ti 99/ Oregon trail prototype project conversion

72 replies to this topic

#26 Casey OFFLINE  

Casey

    Chopper Commander

  • 140 posts

Posted Fri Aug 4, 2017 5:22 PM

Even the multiple statement lines that Extended BASIC offers will save memory, and may be enough to get you there.  The wealth of options with DISPLAY AT and ACCEPT AT will also make screen formatting so much easier than scrolling or plotting characters via a loop.  You may be much happier with the final product. 



#27 arcadeshopper ONLINE  

arcadeshopper

    River Patroller

  • 2,614 posts
  • Location:Portland, Oregon USA

Posted Fri Aug 4, 2017 6:17 PM

and rxb will run the ti-basic code without modification but supports more ram.. xb will also but not the last few char sets 

 

Greg



#28 TheTIGuy OFFLINE  

TheTIGuy

    Dragonstomper

  • Topic Starter
  • 530 posts
  • “cheap, fast, good – choose any two”
  • Location:The west end of Hell...

Posted Sat Aug 5, 2017 2:46 AM

Well, this subject has EXPLODED in popularity, and after loading it up with emulators for the CDC Cyber, the code is "iffy" on the original machine, and loading the code into classic99 (made by a fellow AtariAge user, Tursi!) takes forever, and BASIC and XB run out of memory, and when it does load, i only get to line 350, so,in short the code is and always has been, JUNK.



#29 Ksarul OFFLINE  

Ksarul

    River Patroller

  • 4,234 posts

Posted Sat Aug 5, 2017 7:08 AM

Just because there are problems with the original doesn't make it junk--it makes it a challenge.  :) Note: it shouln't run out of memory while working on it with some form of 32K expansion and Extended BASIC. Working on it in that environment allows you to first get the code functional and then to distill it down to something that will fit into a bare console's memory.



#30 JamesD OFFLINE  

JamesD

    Quadrunner

  • 7,854 posts
  • Location:Flyover State

Posted Sat Aug 5, 2017 7:53 AM

The code is poorly written for sure, but I wouldn't call it junk.  It is more of a prototype than a final product.
Running out of memory on the TI certainly isn't reason enough to call it junk.  The TI has a few quirks when it comes to memory.
The program definitely needed an experienced programmer to rewrite it, and in fact, that's what happened, they just didn't release the source code for that version.
 



#31 majestyx OFFLINE  

majestyx

    Chopper Commander

  • 159 posts
  • Location:Port Carbon, Pennsylvania

Posted Sat Aug 5, 2017 6:58 PM

I'm not certain why you would want to load the code as it is into the TI since it is not in TI BASIC, not to mention the numerous typos (due to OCR errors which weren't cleaned up) in the TXT file you shared such as incorrect / inconsistent variable names, wrong line numbers, incompatible mathematical operations (e.g. ** is used for exponents on the CDC Cyber while ^ is used on the TI), not to mention the CLK(0) function which doesn't exist on a TI or functions that are formatted differently on the TI such as RND which is RND(-1) in the listing you provided. I do admire your desire to get it ported to the TI, but it's obvious that, as I mentioned in one of my earlier posts, a lot of work still needs to be done on it to simply make it work on TI's dialect of BASIC / Extended BASIC. I personally worked on it this past week and corrected most of the errors I mentioned above, in addition to fixes to some of the original's inefficiencies, and still ran out of memory with around 80 lines of code to still work on. And while I'm not happy about it, my earlier concerns about not enough memory on a bare TI was indeed proven correct... at least in the approach I used to port it.

 

That being said, I haven't given up on trying to get *a* version of this to work in TI BASIC. I'm currently working on a port of David H. Ahl's WESTWARD HO variation of The Oregon Trail which is available on AtariAge here: http://www.atariarch..._WestwardHo.php

 

It's a lot cleaner code with some structure to it which helps to cut some of the redundancy as well as what I'm assuming was unintentionally obfuscated code that was published in the 1978 Creative Computing article. I believe that the code ended up the way it did because the first version was actually created by someone who had experience on the CDC Cyber as opposed to the guy whose idea the program was who later worked on it himself. This is conjecture on my part, but I couldn't help but notice this past week how some parts of the code are really nicely done while others are quite sloppy, leaving me to wonder out loud "why would you do that?!"

 

Anyway, TheTIGuy, thanks again for lighting a fire under my @$$ in getting excited about TI programming once again. It reminds me of the reason I fell in love with it back when I was in 8th grade in 1982/1983!



#32 majestyx OFFLINE  

majestyx

    Chopper Commander

  • 159 posts
  • Location:Port Carbon, Pennsylvania

Posted Sat Aug 5, 2017 8:14 PM

Not sure why I didn't think of this earlier, but I am going to try continuing with the original Oregon Trail program BUT will not include the instructions at the beginning. I realized this as I was working on the Westward Ho! 1847 version. While it would be nice to have the instructions / back story, I'm going to remove this part and see if I can squeeze the rest of the code into the space freed by doing so.



#33 TheTIGuy OFFLINE  

TheTIGuy

    Dragonstomper

  • Topic Starter
  • 530 posts
  • “cheap, fast, good – choose any two”
  • Location:The west end of Hell...

Posted Sun Aug 6, 2017 12:23 AM

Not sure why I didn't think of this earlier, but I am going to try continuing with the original Oregon Trail program BUT will not include the instructions at the beginning. I realized this as I was working on the Westward Ho! 1847 version. While it would be nice to have the instructions / back story, I'm going to remove this part and see if I can squeeze the rest of the code into the space freed by doing so.

 

 

I'm not certain why you would want to load the code as it is into the TI since it is not in TI BASIC, not to mention the numerous typos (due to OCR errors which weren't cleaned up) in the TXT file you shared such as incorrect / inconsistent variable names, wrong line numbers, incompatible mathematical operations (e.g. ** is used for exponents on the CDC Cyber while ^ is used on the TI), not to mention the CLK(0) function which doesn't exist on a TI or functions that are formatted differently on the TI such as RND which is RND(-1) in the listing you provided. I do admire your desire to get it ported to the TI, but it's obvious that, as I mentioned in one of my earlier posts, a lot of work still needs to be done on it to simply make it work on TI's dialect of BASIC / Extended BASIC. I personally worked on it this past week and corrected most of the errors I mentioned above, in addition to fixes to some of the original's inefficiencies, and still ran out of memory with around 80 lines of code to still work on. And while I'm not happy about it, my earlier concerns about not enough memory on a bare TI was indeed proven correct... at least in the approach I used to port it.

 

That being said, I haven't given up on trying to get *a* version of this to work in TI BASIC. I'm currently working on a port of David H. Ahl's WESTWARD HO variation of The Oregon Trail which is available on AtariAge here: http://www.atariarch..._WestwardHo.php

 

It's a lot cleaner code with some structure to it which helps to cut some of the redundancy as well as what I'm assuming was unintentionally obfuscated code that was published in the 1978 Creative Computing article. I believe that the code ended up the way it did because the first version was actually created by someone who had experience on the CDC Cyber as opposed to the guy whose idea the program was who later worked on it himself. This is conjecture on my part, but I couldn't help but notice this past week how some parts of the code are really nicely done while others are quite sloppy, leaving me to wonder out loud "why would you do that?!"

 

Anyway, TheTIGuy, thanks again for lighting a fire under my @$$ in getting excited about TI programming once again. It reminds me of the reason I fell in love with it back when I was in 8th grade in 1982/1983!

Whoa, I heard about "westward ho" but couldn't find it! The code is loads better! I'll start on adjusting it right away!



#34 majestyx OFFLINE  

majestyx

    Chopper Commander

  • 159 posts
  • Location:Port Carbon, Pennsylvania

Posted Sun Aug 6, 2017 6:58 PM

Okay, so here is what I was able to come up with that will run on an stock TI-99/4A in TI BASIC. It's pretty bare bones.

 

I completely removed the instructions as well as shortened some messages and removed some non-essential wrap-up during the end game. That means it doesn't have much personality, but does play a complete game without running out of memory while running. It's at the point where if another line or two would be added, the game will stop with an out of memory error while playing.

 

I provided some error checking that wasn't in the Creative Computing version, used arrays for some repeated text as suggested by JamesD, added a sound alert when you are surprised by an attack from animals and bandits, and came up with a custom way of timing for typing the gunshots. Also, when you are out of money, the game will not offer to stop at a fort or, if all money has been used up on previous purchases, to exit before asking how much you want to spend on the remaining items. Otherwise, it was a matter of "translating" the original program listing to TI BASIC and squeezing what I could into the memory available to successfully both store and run the program.

 

I've attached a ZIP file containing the program which can be run withing Classic99 by placing it in one of the DSK directories (I used DSK1, but you can chose whichever you like), as well as a TXT file LISTing of it which I renumbered so as to make the line numbers not so untidy as compared to my "development" version. I've also included it below in a code box for easy reference.

 

This was a fun dip back into TI BASIC programming. Again, it's no frills, but I'm happy that I was able to get it to work. Should anyone want to optimize it further, feel free to have a go at it.

 

Attached File  TI Oregon trail.zip   11.88KB   9 downloads

5 DIM SA(4,4)
10 DIM S$(4)
15 DIM DT$(19)
20 DIM WD$(7)
25 DIM D(15)
30 FOR LP=1 TO 4
35 FOR D1=1 TO 4
40 READ SA(LP,D1)
45 NEXT D1
50 READ S$(LP)
55 NEXT LP
60 DATA 66,65,78,71,"BANG",66,76,65,77,"BLAM"
65 DATA 66,79,79,77,"BOOM",87,72,65,77,"WHAM"
70 FOR LP=1 TO 19
75 READ DT$(LP)
80 NEXT LP
85 DATA "APRIL 12","APRIL 26","MAY 10","MAY 24","JUNE 7"
90 DATA "JUNE 21","JULY 5","JULY 19","AUGUST 2","AUGUST 16","AUGUST 31","SEPTEMBER 13"
95 DATA "SEPTEMBER 27","OCTOBER 11","OCTOBER 25","NOVEMBER 8","NOVEMBER 22"
100 DATA "DECEMBER 6","DECEMBER 20"
105 FOR LP=1 TO 7
110 READ WD$(LP)
115 NEXT LP
120 DATA "MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY","SUNDAY"
125 FOR D1=1 TO 15
130 READ D(D1)
135 NEXT D1
140 DATA 6,11,13,15,17,22,32,35,37,42,44,54,64,69,95
145 CALL CLEAR
150 RANDOMIZE
155 PRINT :"HOW GOOD A SHOT ARE YOU?"
160 PRINT " (1) ACE MARKSMAN"
165 PRINT " (2) GOOD SHOT"
170 PRINT " (3) FAIR TO MIDDLIN'"
175 PRINT " (4) NEED MORE PRACTICE"
180 PRINT " (5) SHAKY KNEES"::
185 INPUT "(1-5): ":D9
190 IF (D9<1)+(D9>5)THEN 185
195 D9=D9*25
200 X1=-1
205 T=700
210 GOSUB 2575
215 PRINT :"HOW MUCH DO YOU WANT TO"
220 PRINT "SPEND ON YOUR OXEN TEAM?"
225 INPUT "(200-300) ":A
230 IF (A<200)+(A>300)THEN 225
235 T=T-A
240 GOSUB 2575
245 INPUT "ON FOOD? ":F
250 IF (F<0)+(F>T)THEN 245
255 T=T-F
260 IF T=0 THEN 335
265 GOSUB 2575
270 INPUT "ON AMMUNITION? ":B
275 IF (B<0)+(B>T)THEN 270
280 T=T-B
285 IF T=0 THEN 335
290 GOSUB 2575
295 INPUT "ON CLOTHING ?":C
300 IF (C<0)+(C>T)THEN 295
305 T=T-C
310 IF T=0 THEN 335
315 GOSUB 2575
320 INPUT "ON MISC. SUPPLIES? ":M1
325 IF (M1<0)+(M1>T)THEN 320
330 T=T-M1
335 B=B*50
340 PRINT :"MONDAY - MARCH 29, 1847"
345 GOTO 405
350 IF M>=2040 THEN 2120
355 D3=D3+1
360 PRINT :"MONDAY - ";
365 IF D3>19 THEN 380
370 PRINT DT$(D3);
375 GOTO 400
380 PRINT :"YOU HAVE BEEN ON THE TRAIL"
385 PRINT "TOO LONG -- YOUR FAMILY DIESIN THE FIRST BLIZZARD"
390 PRINT "OF WINTER"
395 GOTO 2090
400 PRINT ", 1847"::
405 GOSUB 2520
410 IF F>=13 THEN 420
415 PRINT :"YOU'D BETTER DO SOME HUNTINGOR BUY FOOD SOON!!!!"
420 F=INT(F)
425 B=INT(B)
430 C=INT(C)
435 M1=INT(M1)
440 T=INT(T)
445 M=INT(M)
450 M2=M
455 IF (S4=1)+(K8=1)THEN 465
460 GOTO 485
465 IF T<20 THEN 2045
470 T=T-20
475 PRINT "THE DOCTOR'S BILL IS $20"
480 K8=0
485 IF M9=1 THEN 500
490 PRINT "TOTAL MILEAGE IS";M
495 GOTO 510
500 PRINT :"TOTAL MILEAGE IS 950"
505 M9=0
510 GOSUB 2490
515 IF (X1=-1)+(T<=0)THEN 550
520 X1=X1*(-1)
525 PRINT :"DO YOU WANT TO (1) STOP AT"
530 INPUT "THE NEXT FORT, (2) HUNT, OR (3) CONTINUE? ":X
535 IF (X<1)+(X>3)THEN 525
540 X=INT(X)
545 GOTO 595
550 INPUT "DO YOU WANT TO (1) HUNT, OR (2) CONTINUE? ":X
555 IF (X<1)+(X>2)THEN 550
560 X=X+1
565 IF (X=3)+(B>39)THEN 590
570 PRINT :"SORRY --- YOU NEED MORE"
575 PRINT "BULLETS TO GO HUNTING"
580 PRINT :"CONTINUING..."
585 X=3
590 X1=X1*(-1)
595 ON X GOTO 600,720,810
600 IF T<=0 THEN 710
605 PRINT :"YOU HAVE $";T
610 PRINT "ENTER WHAT YOU WISH TO SPENDON THE FOLLOWING"
615 INPUT "FOOD $":P
620 IF (P<0)+(P>T)THEN 605
625 T=T-P
630 F=F+2/3*P
635 IF T=0 THEN 710
640 INPUT "AMMUNITION $":P
645 IF (P<0)+(P>T)THEN 640
650 T=T-P
655 B=INT(B+2/3*P*50)
660 IF T=0 THEN 710
665 INPUT "CLOTHING $":P
670 IF (P<0)+(P>T)THEN 665
675 T=T-P
680 C=C+2/3*P
685 IF T=0 THEN 710
690 INPUT "MISC. SUPPLIES $":P
695 IF (P<0)+(P>T)THEN 690
700 T=T-P
705 M1=M1+2/3*P
710 M=M-45
715 GOTO 810
720 IF B>39 THEN 740
725 PRINT :"SORRY --- YOU NEED MORE"
730 PRINT "BULLETS TO GO HUNTING"
735 GOTO 525
740 M=M-45
745 GOSUB 2330
750 IF B1<=1 THEN 775
755 IF 100*RND<13*B1 THEN 805
760 PRINT :"NICE SHOT, RIGHT ON TARGET! GOOD EATIN' TONIGHT!!"
765 B=B-10-3*B1
770 GOTO 810
775 PRINT :"RIGHT BETWEEN THE EYES"
780 PRINT "---YOU GOT A BIG ONE!!!"
785 PRINT "FULL BELLIES TONIGHT!"
790 F=F+52+RND*6
795 B=B-10-RND*4
800 GOTO 810
805 PRINT :"YOU MISSED---AND YOUR DINNERGOT AWAY"
810 IF F>=13 THEN 820
815 GOTO 2030
820 PRINT :"DO YOU WANT TO EAT"
825 PRINT " (1) POORLY"
830 PRINT " (2) MODERATELY OR"
835 INPUT " (3) WELL? ":E
840 IF (E<1)+(E>3)THEN 820
845 E=INT(E)
850 F=F-8-5*E
855 IF F>=0 THEN 875
860 F=F+8+5*E
865 PRINT :"NOT ENOUGH TO EAT THAT WELL"
870 GOTO 820
875 M=M+200+(A-220)/5+10*RND
880 L1=0
885 C1=0
890 IF RND*10>((M/100-4)^2+72)/((M/100-4)^2+12)-1 THEN 1215
895 PRINT :"RIDERS AHEAD. THEY ";
900 S5=0
905 IF RND<.8 THEN 920
910 PRINT "DON'T "
915 S5=1
920 PRINT "LOOK HOSTILE"
925 PRINT :"TACTICS"
930 PRINT " (1) RUN"
935 PRINT " (2) ATTACK"
940 PRINT " (3) CONTINUE"
945 INPUT " (4) CIRCLE WAGONS? ":T1
950 IF (T1<1)+(T1>4)THEN 925
955 T1=INT(T1)
960 IF RND>.2 THEN 970
965 S5=1-S5
970 IF S5=1 THEN 1110
975 ON T1 GOTO 980,1005,1070,1090
980 M=M+20
985 M1=M1-15
990 B=B-150
995 A=A-40
1000 GOTO 1165
1005 GOSUB 2330
1010 B=B-B1*40-80
1015 IF B1>1 THEN 1035
1020 PRINT :"NICE SHOOTING!"
1025 PRINT "YOU DROVE THEM OFF!!"
1030 GOTO 1165
1035 IF B1<=4 THEN 1060
1040 PRINT :"LOUSY SHOT---YOU GOT KNIFED"
1045 K8=1
1050 PRINT "YOU HAVE TO SEE THE DOCTOR"
1055 GOTO 1165
1060 PRINT :"BIT SLOW WITH YOUR COLT .45"
1065 GOTO 1165
1070 IF RND>.8 THEN 1155
1075 B=B-150
1080 M1=M1-15
1085 GOTO 1165
1090 GOSUB 2330
1095 B=B-B1*30-80
1100 M=M-25
1105 GOTO 1015
1110 ON T1 GOTO 1115,1130,1165,1145
1115 M=M+15
1120 A=A-10
1125 GOTO 1165
1130 M=M-5
1135 B=B-100
1140 GOTO 1165
1145 M=M-20
1150 GOTO 1165
1155 PRINT :"THEY DID NOT ATTACK"
1160 GOTO 1215
1165 IF S5=0 THEN 1185
1170 PRINT :"RIDERS WERE FRIENDLY, BUT"
1175 PRINT "CHECK FOR POSSIBLE LOSSES"
1180 GOTO 1215
1185 PRINT :"RIDERS WERE HOSTILE,"
1190 PRINT "CHECK FOR LOSSES"
1195 IF B>=0 THEN 1215
1200 PRINT :"YOU RAN OUT OF BULLETS AND"
1205 PRINT "GOT MASSACRED BY THE RIDERS"
1210 GOTO 2090
1215 R1=INT(100*RND)+1
1220 FOR D1=1 TO 15
1225 IF R1<=D(D1)THEN 1235
1230 NEXT D1
1235 IF D1>10 THEN 1245
1240 ON D1 GOTO 1250,1270,1295,1330,1345,1365,1385,1425,1525,1565
1245 ON D1-10 GOTO 1585,1620,1650,1815,1795,1825
1250 PRINT :"WAGON BREAKS DOWN--LOSE TIME& SUPPLIES FIXING IT"
1255 M=M-15-5*RND
1260 M1=M1-8
1265 GOTO 1845
1270 PRINT :"OX INJURES LEG---SLOWS YOU"
1275 PRINT "DOWN REST OF TRIP"
1280 M=M-25
1285 A=A-20
1290 GOTO 1845
1295 PRINT :"BAD LUCK---YOUR DAUGHTER"
1300 PRINT "BROKE HER ARM. YOU HAD TO"
1305 PRINT "STOP AND USE SUPPLIES TO"
1310 PRINT "MAKE A SLING"
1315 M=M-5-4*RND
1320 M1=M1-2-3*RND
1325 GOTO 1845
1330 PRINT :"OX WANDERS OFF---SPEND TIME LOOKING FOR IT"
1335 M=M-17
1340 GOTO 1845
1345 PRINT :"YOUR SON GETS LOST---SPEND"
1350 PRINT "HALF A DAY LOOKING FOR HIM"
1355 M=M-10
1360 GOTO 1845
1365 PRINT :"UNSAFE WATER---LOSE TIME"
1370 PRINT "LOOKING FOR CLEAN SPRING"
1375 LET M=M-10*RND*-2
1380 GOTO 1845
1385 IF M>950 THEN 1730
1390 PRINT :"HEAVY RAINS---TIME &"
1395 PRINT "SUPPLIES LOST"
1400 F=F-10
1405 B=B-500
1410 M1=M1-15
1415 M=M-10*RND-5
1420 GOTO 1845
1425 PRINT :"BANDITS ATTACK!"
1430 CALL SOUND(1000,-4,0)
1435 GOSUB 2330
1440 B=B-20*B1
1445 IF B>=0 THEN 1465
1450 PRINT :"YOU RAN OUT OF BULLETS--THEYGET LOTS OF CASH"
1455 T=T/3
1460 GOTO 1470
1465 IF B1<=1 THEN 1510
1470 PRINT :"YOU GOT SHOT IN THE LEG"
1475 PRINT "AND TOOK ONE OF YOUR OXEN"
1480 K8=1
1485 PRINT :"BETTER HAVE A DOC LOOK AT"
1490 PRINT "YOUR WOUND"
1495 M1=M1-5
1500 A=A-20
1505 GOTO 1845
1510 PRINT :"QUICKEST DRAW OUTSIDE OF"
1515 PRINT "DODGE CITY!!! YOU GOT 'EM!"
1520 GOTO 1845
1525 PRINT :"THERE WAS A FIRE IN YOUR"
1530 PRINT "WAGON---FOOD & SUPPLIES"
1535 PRINT "DAMAGED!"
1540 F=F-40
1545 B=B-400
1550 M1=M1-RND*8-3
1555 M=M-15
1560 GOTO 1845
1565 PRINT :"LOSE YOUR WAY IN HEAVY FOG"
1570 PRINT "...TIME IS LOST"
1575 M=M-10-5*RND
1580 GOTO 1845
1585 PRINT :"YOU KILLED A POISONOUS SNAKEAFTER IT BIT YOU"
1590 B=B-10
1595 M1=M1-5
1600 IF M1>=0 THEN 1845
1605 PRINT :"YOU DIE OF SNAKEBITE SINCE"
1610 PRINT "YOU HAVE NO MEDICINE"
1615 GOTO 2090
1620 PRINT :"WAGON GETS SWAMPED FORDING"
1625 PRINT "RIVER--LOSE FOOD & CLOTHES"
1630 F=F-30
1635 C=C-20
1640 M=M-20-20*RND
1645 GOTO 1845
1650 PRINT :"WILD ANIMALS ATTACK!"
1655 CALL SOUND(1000,-7,0)
1660 GOSUB 2330
1665 IF B>39 THEN 1690
1670 PRINT :"YOU WERE TOO LOW ON BULLETS"
1675 PRINT "THE WOLVES OVERPOWERED YOU"
1680 K8=1
1685 GOTO 2065
1690 IF B1>2 THEN 1705
1695 PRINT :"NICE SHOOTIN' PARDNER---THEYDIDN'T GET MUCH"
1700 GOTO 1710
1705 PRINT :"SLOW ON THE DRAW---THEY GOT AT YOUR FOOD & CLOTHES"
1710 B=B-20*B1
1715 C=C-B1*4
1720 F=F-B1*8
1725 GOTO 1845
1730 PRINT :"COLD WEATHER---BRRRRR!---YOU"
1735 IF C>22+4*RND THEN 1750
1740 PRINT "DON'T ";
1745 C1=1
1750 PRINT "HAVE ENOUGH CLOTHING"
1755 PRINT "TO KEEP WARM"
1760 IF C1=0 THEN 1845
1765 GOTO 2405
1770 PRINT :"HAIL STORM--SUPPLIES DAMAGED"
1775 M=M-5-RND*10
1780 B=B-200
1785 M1=M1-4-RND*3
1790 GOTO 1845
1795 IF E=1 THEN 2405
1800 IF E=3 THEN 1815
1805 IF RND>.25 THEN 2405
1810 GOTO 1845
1815 IF RND<.5 THEN 2405
1820 GOTO 1845
1825 PRINT :"HELPFUL NATIVES SHOW YOU"
1830 PRINT "WHERE TO FIND MORE FOOD"
1835 F=F+14
1840 GOTO 1845
1845 IF M<=950 THEN 350
1850 IF RND*10>9-((M/100-15)^2+72)/((M/100-15)^2+12)THEN 1925
1855 PRINT :"RUGGED MOUNTAINS"
1860 IF RND>.1 THEN 1885
1865 PRINT :"YOU GOT LOST AND LOSE"
1870 PRINT "VALUABLE TIME TRYING TO FINDA TRAIL!"
1875 M=M-60
1880 GOTO 1925
1885 IF RND>.11 THEN 1915
1890 PRINT :"WAGON DAMAGED! LOSE TIME ANDSUPPLIES"
1895 M1=M1-5
1900 B=B-200
1905 M=M-20-30*RND
1910 GOTO 1925
1915 PRINT :"THE GOING GETS SLOW..."
1920 M=M-45-RND/.02
1925 IF F1=1 THEN 1950
1930 F1=1
1935 IF RND<.8 THEN 1985
1940 PRINT :"YOU MADE IT SAFELY THROUGH"
1945 PRINT "SOUTH PASS--NO SNOW"
1950 IF M<1700 THEN 1970
1955 IF F2=1 THEN 1970
1960 F2=1
1965 IF RND<.7 THEN 1985
1970 IF M>950 THEN 350
1975 M9=1
1980 GOTO 350
1985 PRINT :"BLIZZARD IN MOUNTAINS AT"
1990 PRINT "SOUTH PASS--TIME & SUPPLIES LOST"
1995 L1=1
2000 F=F-25
2005 M1=M1-10
2010 B=B-300
2015 M=M-30-40*RND
2020 IF C<18+2*RND THEN 2405
2025 GOTO 1970
2030 PRINT :"YOU RAN OUT OF FOOD AND"
2035 PRINT "STARVED TO DEATH"
2040 GOTO 2090
2045 PRINT "YOU CAN'T AFFORD A DOCTOR"
2050 GOTO 2065
2055 PRINT :"YOU RAN OUT OF MEDICAL"
2060 PRINT "SUPPLIES"
2065 PRINT :"YOU DIED OF ";
2070 IF K8=1 THEN 2085
2075 PRINT "PNEUMONIA"
2080 GOTO 2090
2085 PRINT "INJURIES"
2090 PRINT :"WE ARE SORRY YOU DIDN'T MAKEIT TO THE GREAT TERRITORY OFOREGON"
2095 PRINT :"BETTER LUCK NEXT TIME!"
2100 PRINT ::"- SINCERELY,"
2105 PRINT :"THE OREGON CITY"
2110 PRINT "CHAMBER OF COMMERCE"
2115 STOP
2120 F9=(2040-M2)/(M-M2)
2125 F=F+(1-F9)*(8+5*E)
2130 PRINT :"YOU FINALLY ARRIVED AT"
2135 PRINT "OREGON CITY AFTER 2040 LONG MILES---HOORAY!!!!!"
2140 PRINT "A REAL PIONEER!"::
2145 FOR LP=1 TO 1000
2150 NEXT LP
2155 F9=INT(F9*14)
2160 D3=D3*14+F9
2165 F9=F9+1
2170 IF F9<8 THEN 2180
2175 F9=F9-7
2180 PRINT WD$(F9)
2185 IF D3>124 THEN 2205
2190 D3=D3-93
2195 PRINT "JULY";D3;"1847"
2200 GOTO 2295
2205 IF D3>155 THEN 2225
2210 D3=D3-124
2215 PRINT "AUGUST";D3;"1847"
2220 GOTO 2295
2225 IF D3>185 THEN 2245
2230 D3=D3-155
2235 PRINT "SEPTEMBER";D3;"1847"
2240 GOTO 2295
2245 IF D3>216 THEN 2265
2250 D3=D3-185
2255 PRINT "OCTOBER";D3;"1847"
2260 GOTO 2295
2265 IF D3>246 THEN 2285
2270 D3=D3-216
2275 PRINT "NOVEMBER";D3;"1847"
2280 GOTO 2295
2285 D3=D3-246
2290 PRINT "DECEMBER";D3;"1847"
2295 GOSUB 2520
2300 GOSUB 2490
2305 PRINT :"PRESIDENT JAMES K. POLK"
2310 PRINT "SENDS YOU HIS HEARTIEST"
2315 PRINT "CONGRATULATIONS AND WISHES"
2320 PRINT "YOU A PROSPEROUS LIFE AHEAD AT YOUR NEW HOME."
2325 STOP
2330 S6=INT(RND*4+1)
2335 PRINT :"TYPE ";S$(S6)
2340 TIME=0
2345 LTR=1
2350 CALL KEY(0,K,S)
2355 TIME=TIME+1
2360 IF (S=0)+(S=-1)THEN 2350
2365 IF K<>SA(S6,LTR)THEN 2350
2370 PRINT CHR$(SA(S6,LTR));
2375 LTR=LTR+1
2380 IF LTR<5 THEN 2350
2385 B1=TIME-D9
2390 IF B1>0 THEN 2400
2395 B1=0
2400 RETURN
2405 IF 100*RND<10+35*(E-1)THEN 2440
2410 IF 100*RND<100-(40/4^(E-1))THEN 2460
2415 PRINT :"SERIOUS ILLNESS---YOU MUST"
2420 PRINT "STOP FOR MEDICAL ATTENTION"
2425 M1=M1-10
2430 S4=1
2435 GOTO 2475
2440 PRINT :"MILD ILLNESS---MEDICINE USED"
2445 M=M-5
2450 M1=M1-2
2455 GOTO 2475
2460 PRINT "BAD ILLNESS---MEDICINE USED."
2465 M=M-5
2470 M1=M1-5
2475 IF M1<0 THEN 2055
2480 IF L1=1 THEN 1970
2485 GOTO 1845
2490 PRINT :"FOOD:";INT(F)
2495 PRINT "BULLETS:";INT(B)
2500 PRINT "CLOTHING:";INT(C)
2505 PRINT "MISC. SUPPLIES:";INT(M1)
2510 PRINT "CASH:";INT(T)
2515 RETURN
2520 IF F>=0 THEN 2530
2525 F=0
2530 IF B>=0 THEN 2540
2535 B=0
2540 IF C>=0 THEN 2550
2545 C=0
2550 IF M1>=0 THEN 2560
2555 M1=0
2560 IF T>0 THEN 2570
2565 T=0
2570 RETURN
2575 PRINT :"YOU HAVE $";T
2580 RETURN



#35 Ksarul OFFLINE  

Ksarul

    River Patroller

  • 4,234 posts

Posted Sun Aug 6, 2017 7:11 PM

Nice bit of work, @majestyx! Any more complex translation would probably require Extended BASIC (or at least RXB), unless there was a way to further optimize this code to shrink it substantially enough to add features back in.



#36 majestyx OFFLINE  

majestyx

    Chopper Commander

  • 159 posts
  • Location:Port Carbon, Pennsylvania

Posted Sun Aug 6, 2017 8:14 PM

Definitely quick and dirty. There is probably a better way to program the date of your arrival in Oregon City (lines 2155-2290) but since I was already having to cut back code to get this part in, I didn't take the time to figure out a better/more efficient formula.

 

I would have liked to have added some different color text, a routine to display the text more efficiently (I did format it to account for the TI's 28 characters per line limitation), add some more sound, more "deaths" and a better wrap up at the end. As it is, it's a 1981 TI BASIC version of a 1978 CDC Cyber version of a 1973 HP Timeshare BASIC program, not much more.

 

Just a note - if you run it Classic99, you can start it in an accelerated mode in order to speed up whatever it does when you type RUN, but be sure to set it back to Normal. Otherwise, the shooting routine will be running too fast for you to be successful.


Edited by majestyx, Sun Aug 6, 2017 8:18 PM.


#37 TheTIGuy OFFLINE  

TheTIGuy

    Dragonstomper

  • Topic Starter
  • 530 posts
  • “cheap, fast, good – choose any two”
  • Location:The west end of Hell...

Posted Mon Aug 7, 2017 4:00 AM

WOW! majestyx you are the first person to port The Oregon Trail to TI-99! i will clean up the numbering soon and post the re-numbered version here.



#38 carlsson OFFLINE  

carlsson

    Metagalactic Mule

  • 5,201 posts
  • Location:Västerås, Sweden

Posted Mon Aug 7, 2017 4:20 AM

Although I don't know TI BASIC, would you save any memory by concatenating strings with extra spaces instead of multiple PRINT statements, e.g. in lines 2305-2320? Or perhaps padding out the string would cost more than adding a new line with its own PRINT statement.



#39 majestyx OFFLINE  

majestyx

    Chopper Commander

  • 159 posts
  • Location:Port Carbon, Pennsylvania

Posted Mon Aug 7, 2017 7:24 AM

Although I don't know TI BASIC, would you save any memory by concatenating strings with extra spaces instead of multiple PRINT statements, e.g. in lines 2305-2320? Or perhaps padding out the string would cost more than adding a new line with its own PRINT statement.

 

I'm thinking that's possible, but since I had no information to go on, I used the multiple PRINTs and didn't want to keep undoing/redoing to see what would happen. It did seem when I added another line that I'd run out of runtime memory for variables so I'm guessing it could help save some memory.



#40 RXB OFFLINE  

RXB

    River Patroller

  • 2,840 posts
  • Location:Vancouver, Washington, USA

Posted Mon Aug 7, 2017 8:18 AM

Being a GPL programmer for XB, Basic and RXB I can tell you why strings take more memory than a PRINT statement.

Strings have to allot a Name, address, length and string for each one. Also each time the string is used it makes a copy of it temporarily in VDP.

On the other hand PRINT only has a 1 token for PRINT, token for string, length and string. (Notice no name or address needed, also no copy is made.)


Edited by RXB, Mon Aug 7, 2017 8:19 AM.


#41 JamesD OFFLINE  

JamesD

    Quadrunner

  • 7,854 posts
  • Location:Flyover State

Posted Mon Aug 7, 2017 8:58 AM

I don't know if Jim did anything but change the format of the text and create a covered wagon graphic, but you could check out his code if you are interested.



#42 Casey OFFLINE  

Casey

    Chopper Commander

  • 140 posts

Posted Mon Aug 7, 2017 4:29 PM

 

I'm thinking that's possible, but since I had no information to go on, I used the multiple PRINTs and didn't want to keep undoing/redoing to see what would happen. It did seem when I added another line that I'd run out of runtime memory for variables so I'm guessing it could help save some memory.

Forgive me if you already know this, but PRINT statements can be combined in TI BASIC in a way most BASICs don't allow.  (This is also useful for folks who are new to TI BASIC, but come from other dialects).

 

2305 PRINT :"PRESIDENT JAMES K. POLK"
2310 PRINT "SENDS YOU HIS HEARTIEST"
2315 PRINT "CONGRATULATIONS AND WISHES"
2320 PRINT "YOU A PROSPEROUS LIFE AHEAD AT YOUR NEW HOME."

 

Can be combined as:

2305 PRINT :"PRESIDENT JAMES K. POLK":"SENDS YOU HIS HEARTIEST":"CONGRATULATIONS AND WISHES":"YOU A PROSPEROUS LIFE AHEAD AT YOUR NEW HOME."

 

You can do this so long as you don't exceed the 4 screen line limit of a TI BASIC statement.  You can actually usually coax an extra screen line by using the EDIT command and you may be able to get 2 extras that way before getting a * LINE TOO LONG error.

 

This may save you a bit of memory since this just has 1 PRINT token, a token each for the colons, and whatever the strings take, but requires only 1 line instead of 4. 

 

A bit of a diversion: Each colon represents a carriage return - you can stack colons for multiple blank lines if you like.

Ex: 100 PRINT "STRING 1"::::"STRING 2"

 

Extended BASIC uses 2 colons as the statement separator in a multiple statement line, so you have to put spaces between these colons to prevent confusing it

Ex: 100 PRINT "STRING 1": : : :"STRING 2"



#43 carlsson OFFLINE  

carlsson

    Metagalactic Mule

  • 5,201 posts
  • Location:Västerås, Sweden

Posted Mon Aug 7, 2017 4:58 PM

I don't know how much space or execution time you would save, but I believe this could be made to work:
 
2185 D4=INT((D3-94)/30.6)
2186 D3=INT(D3-93-(D4*30.6))
2187 ON 1+D4 GOTO 2195,2215,2235,2255,2275,2290
2195 PRINT "JULY";D3;"1847"
2200 GOTO 2295
2215 PRINT "AUGUST";D3;"1847"
2220 GOTO 2295
2235 PRINT "SEPTEMBER";D3;"1847"
2240 GOTO 2295
2255 PRINT "OCTOBER";D3;"1847"
2260 GOTO 2295
2275 PRINT "NOVEMBER";D3;"1847"
2280 GOTO 2295
2290 PRINT "DECEMBER";D3;"1847"
2295 GOSUB 2520
Another one, can you do something like this in TI BASIC?

F=F*(F>0)*-1
assuming TRUE = -1 and FALSE = 0 as in many other dialects.

If so, you could simplify the section 2520-2570 for additional possible savings.

Edited by carlsson, Mon Aug 7, 2017 5:05 PM.


#44 chue OFFLINE  

chue

    Chopper Commander

  • 148 posts

Posted Mon Aug 7, 2017 8:07 PM

Another one, can you do something like this in TI BASIC?


F=F*(F>0)*-1
assuming TRUE = -1 and FALSE = 0 as in many other dialects.

 

 

Nice one!  Yes that does work.  It can be further simplified to:

 

F=-F*(F>0)


Edited by chue, Mon Aug 7, 2017 8:35 PM.


#45 majestyx OFFLINE  

majestyx

    Chopper Commander

  • 159 posts
  • Location:Port Carbon, Pennsylvania

Posted Mon Aug 7, 2017 9:11 PM

To Casey - I've been away from TI BASIC too long. No idea why I didn't think of that. That probably would have enabled at least a few more lines of code to be salvaged.

 

JamesD - pretty impressive implementation on the TRS-80 MC-10. Almost seems like a challenge... ;) Although it appears that the MC-10 had a much more robust BASIC (I see it's a Microsoft version) with many more features than are available with TI's console BASIC resulting in greatly reduced code size. The one statement per line number limitation is a killer and the IF-THEN-ELSE restriction of only being able to GOTO a line number really makes for some challenges.

 

carlsson - I was trying to figure a better way of structuring those sections using a flag but by that time I was already having to remove lines just to get that section in. I admit I was challenging myself to see how quickly I could get it done. If I had spent more time, I probably could have done a better job.

 

As I said, if anyone feels like improving upon what I came up with, by all means go right ahead and have fun!


Edited by majestyx, Mon Aug 7, 2017 9:18 PM.


#46 JamesD OFFLINE  

JamesD

    Quadrunner

  • 7,854 posts
  • Location:Flyover State

Posted Mon Aug 7, 2017 9:56 PM

The MC-10 BASIC fits in 8K.  It's not the most robust BASIC out there, but you can cram in multiple statements per line. 
Frankly, it's much more memory efficient than TI BASIC.  That's one thing Microsoft was pretty good at.
MC-10 BASIC has a unique feature that is really cool.
You can load a numeric array from tape.  No data statements, no loops reading... just dimension your array the same size as what's on tape and CLOAD * something.
Too bad it doesn't work with string arrays.  That would have been the bomb for adventure games!

The one statement per line number limitation on the TI sucks!  There, I said it.   :D


Edited by JamesD, Mon Aug 7, 2017 9:57 PM.


#47 carlsson OFFLINE  

carlsson

    Metagalactic Mule

  • 5,201 posts
  • Location:Västerås, Sweden

Posted Tue Aug 8, 2017 1:00 AM

Yeah, we can keep posting suggested optimizations for The TIGuy to consider when he wraps up the final version. The amount of RAM will be the same no matter who is behind the coding keyboard.

 

One statement per line is a let down, but the fact that IF statements may only branch to a new line instead of executing another statement sometimes may be lousier. Thus I focused on optimizing such parts of the code.



#48 TheTIGuy OFFLINE  

TheTIGuy

    Dragonstomper

  • Topic Starter
  • 530 posts
  • “cheap, fast, good – choose any two”
  • Location:The west end of Hell...

Posted Tue Aug 8, 2017 4:18 AM

Basically done, numbers are a bit diff., used all suggestions listed except one or two. Tested on classic99 (w/o the preface/credits) , works OK. However, it is not quite finished, so i will be updating a lot soon! Attached File  A programme 45 years in the making- The Oregon Trail for TI-99.txt   25.04KB   14 downloads

P.S., may be wise to use a memory module.


Edited by TheTIGuy, Tue Aug 8, 2017 4:26 AM.


#49 carlsson OFFLINE  

carlsson

    Metagalactic Mule

  • 5,201 posts
  • Location:Västerås, Sweden

Posted Tue Aug 8, 2017 5:31 AM

It seems like you pasted in the code twice, one complete version in the middle and two fragments of the same code on either side.



#50 TheTIGuy OFFLINE  

TheTIGuy

    Dragonstomper

  • Topic Starter
  • 530 posts
  • “cheap, fast, good – choose any two”
  • Location:The west end of Hell...

Posted Tue Aug 8, 2017 3:30 PM

It seems like you pasted in the code twice, one complete version in the middle and two fragments of the same code on either side.

Oh. Hmm. It seems i have. I will post the corrected version tomorrow.







Also tagged with one or more of these keywords: 1978, ti, 99/, Oregon, trail, prototype, project, conversion

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users