home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_25_1988_Transactor_Publishing.d64
/
starcart
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
3KB
|
139 lines
100 rem starplot 1.0
110 rem copyright @ 1987
120 rem by stephen shervais jr
130 rem 4868 langer ln
140 rem woodbridge, va, 22193
150 rem compuserve 72060,573
160 print"this program is designed to compute"
170 print"the distance between stars near the sun"
180 print"in cartesian coordinates aligned with"
190 print"the plane of the ecliptic":print
200 def fna(q)=(int(q)/57.296)+((q-int(q))/60/57.296)
210 rem **** input or output *****
220 print"do you wish to create a new file or print out an old one?"
230 print
240 print"1. new file"
250 print"2. old file: cartesian coordinates"
260 print"3. old file: distances"
270 print
280 get a1$: if a1$="" then 280
290 if a1$="1" then gosub 340
300 if a1$="2" then gosub760: gosub970
310 if a1$="3" then gosub760: gosub1120
320 end
330 rem **** input new file ****
340 input"total number of star systems";s1:s1=s1-1
350 dim s$(s1), s(s1,8)
360 for t=0 to s1
370 print"[146]system";t+1
380 input"system name ";s$(t)
390 input"right ascension ";s(t,0)
400 input"declination ";s(t,1)
410 input"distance, ly ";s(t,4)
420 rem **** error check ****
430 print
440 print"check: name "; s$(t)
450 print" r.a. "; s(t,0)
460 print" dec "; s(t,1)
470 print" dist "; s(t,4)
480 input"is this correct (y/n) y[157][157][157]";a2$
490 if a2$<>chr$(89) then 370
500 s(t,2)=fna(s(t,0))*15
510 s(t,3)=fna(s(t,1))
520 gosub 570:rem *** xyz coords ***
530 next t
540 gosub 650:rem ** output to file **
550 return
560 rem ** ecliptic cartesian conv **
570 x=s(t,4)*sin((90/57.296)-s(t,3))*cos(s(t,2))
580 s(t,5)=x
590 y=s(t,4)*sin((90/57.296)-s(t,3))*sin(s(t,2))
600 s(t,6)=y
610 z=s(t,4)*cos((90/57.296)-s(t,3))
620 s(t,7)=z
630 return
640 rem *** output to disk ***
650 input "new file name?";a3$
660 open14,8,14,"0:"+a3$+",s,w"
670 for t=0 to s1
680 print#14,s$(t)
690 for i=0 to 7
700 print#14,s(t,i)
710 next i
720 next t
730 print#14:close14
740 return
750 rem *** input from disk ***
760 input "old file name ";a3$
770 print"do you want to output to screen,"
780 print"or printer?":print
790 print"1. output to screen"
800 print"2. output to printer"
810 get b1$: if b1$="" then 810
820 if b1$<>"1" and b1$<>"2" then 810
830 print
840 input "number of star systems";s1:s1=s1-1
850 if s<0 then return
860 dim s$(s1), s(s1,8)
870 open10,8,10,"0:"+a3$+",s,r"
880 for t=0 to s1
890 input#10,s$(t)
900 for i=0 to 7
910 input#10,s(t,i)
920 next i
930 next t
940 print#10:close10
950 return
960 rem *** ecliptic output ***
970 open4,3: if b1$="2" then close4: open4,4
980 for t=0 to s1
990 print#4
1000 print#4,s$(t)
1010 print#4,"right ascension ";s(t,0);"hours.minutes"
1020 print#4," declination ";s(t,1);"degrees.minutes"
1030 print#4," distance= ";s(t,4);"light years"
1040 print#4," x= ";s(t,5);"light years"
1050 print#4," y= ";s(t,6);"light years"
1060 print#4," z= ";s(t,7);"light years"
1070 if b1$="1" then gosub 1340
1080 next t
1090 print#4:close4
1100 return
1110 rem *** distance output ***
1120 open4,3: if b1$="2" then close4: open4,4
1130 print#4,"distance from sun to ":print
1140 for t=0 to s1
1150 print#4,s$(t);tab(25-len(s$(t)));s(t,4)
1155 if b1$="1" then gosub 1440
1160 next t
1170 print#4:close4
1180 print:input"maximum trip distance ";d2:print
1190 open4,3: if b1$="2" then close4: open4,4
1200 for t=0 to s1-1
1201 gosub 1470
1210 print#4,"distance from ";s$(t);" to:":print:b2=0
1220 for u=t+1 to s1
1230 x1=s(t,5)-s(u,5):x2=x1*x1
1240 y1=s(t,6)-s(u,6):y2=y1*y1
1250 z1=s(t,7)-s(u,7):z2=z1*z1
1260 d1=sqr(x2+y2+z2)
1270 if d1<d2 then print#4,s$(u);tab(25-len(s$(u)));d1
1280 if b1$="1" then gosub 1440
1290 next u
1300 print:next t
1310 print#4:close4
1320 return
1330 rem *****screen counter****
1340 b2=b2+8
1350 if b2=24 then gosub 1370
1360 return
1370 print"hit any key to continue[145]"
1380 get b2$:if b2$="" then 1380
1390 b2=0: return
1440 b2=b2+1
1450 if b2=22 then gosub 1470
1460 return
1470 print"hit any key to continue[145]"
1480 get b2$:if b2$="" then 1480
1490 print:b2=0: return