edlee@chinet.UUCP (Edward Lee) (04/23/88)
The following program was written on a TI-99/4A using the rules in the original BattleTech manual. Feel free to modify the program. Boolean operations return a -1 for a true condition and a 0 for a false condition. As the program stands, it prompts for the BattleMech's type, or name, and from then on prompts for essential data only. It calculates the rest. The tonnage left at the end of the Mech's creation is the tonnage available for weapons. -File begins- 100 !********************** 110 !*BATTLETECH UTILITY#1* 120 !********************** 130 !Copr. 1987 Edward Lee 08/17/87 140 !TI Extended BASIC. This program may not be distributed commercially. 150 PIO$="RS232.BA=1200.DA=8" :: ON WARNING NEXT :: OPTION BASE 1 :: DIM EM$(79) ,ET(79),F$(24),IST(29,4) 160 DATA "*****BATTLEMECH DESIGN******" 170 DATA "" 180 DATA "Type: ######################" 190 DATA "Tonnage: ### tons TONS" 200 DATA "Internal Structure: ##.#" 210 DATA "Engine: ### ####### ##.#" 220 DATA " Walking MP's: ##" 230 DATA " Running MP's: ##" 240 DATA " Jumping MP's: ## ##.#" 250 DATA "No.Heat Sinks: ## ##" 260 DATA "Gryo: ##" 270 DATA "Cockpit: ##" 280 DATA "Armor Factor: #### ##.#" 290 DATA "" 300 DATA " In Armor" 310 DATA " St Value" 320 DATA " Head: ## ##" 330 DATA "Center Torso: ## __/__" 340 DATA "Rt/Lt Torso: ## __/__" 350 DATA " Rt/Lt Arm: ## __" 360 DATA " Rt/Lt Leg: ## __" 370 DATA "" 380 DATA "" 390 DATA "TONS REMAINING: ###.#" 400 !/ENGINE DATA/ 410 DATA Omni,.5,GM,.5,Pitban,.5,Omni,.5,Nissan,1,VOX,1,GM,1,GM,1,DAV,1.5,VOX,1. 5,Leenex,1.5,Nissan,2,Omni,2 420 DATA GM,2,VOX,2.5,DAV,2.5,DAV,3,Nissan,3,Hermes,3,DAV,3.5,GM,3.5,GM,4,GM,4,N issan,4,Vlar,4.5 430 DATA Magna,4.5,Hermes,5,Leenex,5,Omni,5.5,Nissan,5.5,LTV,6,VOX,6,DAV,6,Omni, 7,GM,7,GM,7.5,DAV,7.5,Nisson,8 440 DATA Nisson,8.5,Vlar,8.5,GM,9,CoreTek,9.5,DAV,10,VOX,10,Leenex,10.5,GM,11,Pi tban,11.5,Magna,12,Magna,12.5 450 DATA Strand,13,Magna,13.5,Vlar,14,GM,14.5,CoreTek,15.5,VOX,16,Pitban,16.5,Om ni,17.5,GM,18,Vlar,19 460 DATA GM,19.5,Magna,20.5,GM,21.5,Pitban,22.5,VOX,23.5,VOX,24.5,Leenex,25.5,VO X,27,Vlar,28.5,Magna,29.5 470 DATA LTV,31.5,Hermes,33,Hermes,34.5,Magna,36.5,GM,38.5,GM,41,LTV,43.5,Magna, 46,Hermes,49,LTV,52.5 480 !/INT. STRUCTURE DATA/ 490 DATA 4,3,1,2,5,4,2,3,6,5,3,4,8,6,4,6,10,7,5,7,11,8,6,8,12,10,6,10,14,11,7,11 ,16,12,8,12 500 DATA 18,13,9,13,20,14,10,15,21,15,10,14,22,15,11,15,23,16,12,16,25,17,13,17, 27,18,14,18 510 DATA 29,19,15,19,30,20,16,20,31,21,17,21 520 !///MAIN PROGRAM/// 530 DISPLAY ERASE ALL :: CALL SCREEN(13):: CALL CHAR(35,RPT$("0",14)&"7E",95,RPT $("0",14)&"7E") 540 !//READ SCREEN DATA// 550 FOR I=1 TO 24 :: READ F$(I):: NEXT I :: GOSUB 1150 560 !//READ ENGINE DATA// 570 FOR I=1 TO 79 :: READ EM$(I),ET(I):: NEXT I 580 !//READ INT. STR. DATA// 590 FOR I=1 TO 19 :: FOR J=1 TO 4 :: READ IST(I,J):: NEXT J :: NEXT I 600 !//USER INPUT & CALC// 610 !/TYPE/ 620 ACCEPT AT(3,7)BEEP:T$ 630 !/TONNAGE/ 640 ACCEPT AT(4,10)SIZE(3)VALIDATE(DIGIT):T :: T=INT(T/5)*5 :: IF T<10 OR T>100 THEN 640 650 DISPLAY AT(4,1):USING F$(4):T 660 !/COCKPIT/ 670 CP=3 :: DISPLAY AT(12,1):USING F$(12):CP 680 W=T-CP :: GOSUB 1130 690 !/INTERNAL STRUCTURE/ 700 IS=T/10 :: DISPLAY AT(5,1):USING F$(5):IS 710 DISPLAY AT(17,1):USING F$(17):3,9 :: FOR I=18 TO 21 :: DISPLAY AT(I,1):USING F$(I):IST(T/5-1,I-17):: NEXT I 720 W=W-IS :: GOSUB 1130 730 !/MOVEMENT POINTS/ 740 ACCEPT AT(7,16)SIZE(2)VALIDATE(DIGIT):MP :: IF MP=0 THEN 740 :: ER=T*MP :: I F ER>400 THEN 740 750 I=(ER-5)/5 :: GYRO=INT(ER/100+.9):: IF W-ET(I)-GYRO<1 THEN 740 ELSE W=W-ET(I )-GYRO :: GOSUB 1130 760 DISPLAY AT(7,1):USING F$(7):MP 770 !/ENGINE RATING/ 780 !/RUNNING MP/ 790 !/GYRO/ 800 DISPLAY AT(6,1):USING F$(6):ER,EM$(I),ET(I) 810 DISPLAY AT(8,1):USING F$(8):MP*1.5 820 DISPLAY AT(11,1):USING F$(11):GYRO 830 !/JUMP ABILITY?/ 840 ACCEPT AT(9,16)SIZE(2)VALIDATE(DIGIT):JMP 850 JJ=JMP*((T>55)*(T<90)-(T<60)/2-(T>85)*2) 860 IF W-JJ<=0 THEN 840 ELSE W=W-JJ :: GOSUB 1130 870 DISPLAY AT(9,1):USING F$(9):JMP,JJ 880 !/HEAT SINKS/ 890 DISPLAY AT(10,16)SIZE(2):"10" 900 ACCEPT AT(10,16)SIZE(-2)VALIDATE(DIGIT):HSX :: IF HSX<10 OR HSX>30 THEN 900 910 HS=HSX-10 920 IF W-HS<=0 THEN 900 ELSE W=W-HS :: GOSUB 1130 930 DISPLAY AT(10,1):USING F$(10):HSX,HS 940 !/ARMOR FACTOR/ 950 ACCEPT AT(13,25)SIZE(4):AA :: IF AA=0 THEN 950 :: AA=INT(AA/.5)*.5 :: AV=AA* 16 960 IF W-AA<0 THEN 950 ELSE W=W-AA :: GOSUB 1130 970 DISPLAY AT(13,1):USING F$(13):STR$(AV),AA 980 !//PRINT/REDO SCREEN// 990 DISPLAY AT(23,1):"(P)rint screen (R)edo screen" :: DISPLAY AT(23,1):: CALL K EY(3,K,S):: IF K<>80 AND K<>82 THEN 990 1000 IF K=82 THEN 620 1010 !/PRINT SCREEN/ 1020 DISPLAY AT(23,1)BEEP:"NAME: "&PIO$ 1030 ACCEPT AT(23,7)SIZE(-28):PIO$ :: IF PIO$="" THEN 990 ELSE OPEN #1:PIO$ 1040 PRINT #1:F$(1): : :: PRINT #1,USING F$(3):T$ :: PRINT #1,USING F$(4):T :: P RINT #1,USING F$(5):IS 1050 PRINT #1,USING F$(6):ER,EM$((ER-5)/5),ET((ER-5)/5):: PRINT #1,USING F$(7):M P :: PRINT #1,USING F$(8):MP*1.5 1060 PRINT #1,USING F$(9):JMP,JJ :: PRINT #1,USING F$(10):HSX,HS :: PRINT #1,USI NG F$(11):GYRO :: PRINT #1,USING F$(12):CP 1070 PRINT #1,USING F$(13):STR$(AV),AA :: PRINT #1: :F$(15):F$(16):: PRINT #1,US ING F$(17):3,9 1080 FOR I=1 TO 4 :: PRINT #1,USING F$(I+17):IST(T/5-1,I):: NEXT I 1090 PRINT #1: : : :: PRINT #1,USING F$(24):W :: CLOSE #1 1100 DISPLAY AT(23,1)BEEP:"RERUN (Y/N)? Y" 1110 ACCEPT AT(23,14)SIZE(-1):A$ :: IF A$="Y" THEN GOSUB 1150 :: GOTO 620 1120 DISPLAY ERASE ALL :: END 1130 DISPLAY AT(24,1):USING F$(24):W :: RETURN 1140 !/SHOW SCREEN/ 1150 DISPLAY AT(1,1):F$(1): :F$(3):F$(4):F$(5):F$(6):F$(7):F$(8):F$(9):F$(10):F$ (11):F$(12):F$(13): :F$(15):F$(16):F$(17):F$(18) 1160 DISPLAY AT(19,1):F$(19):F$(20):F$(21):F$(22): :F$(24):: RETURN -End of file- -Ed L