home *** CD-ROM | disk | FTP | other *** search
/ AMIGA PD 1 / AMIGA-PD-1.iso / Programme_zum_Heft / Programmieren / Kurztests / ACE / Prgs / Astronomy / Messier.b < prev   
Text File  |  1994-10-03  |  11KB  |  344 lines

  1. '..Messier Object Finder.
  2.  
  3. const true=-1&,false=0&
  4. const sentinel=-1
  5. const max_lines=15
  6.  
  7. shortint M
  8. single MAG,DEC,RA
  9. string OBJ$,CONSTEL$
  10.  
  11. '..main program
  12. window 1,"Messier Finder",(0,0)-(640,200),6
  13.  
  14. font "topaz",8
  15.  
  16. finished=false
  17.  
  18. while not finished
  19. main:
  20.   restore
  21.   color 1
  22.   cls
  23.   locate 2,10: print "Options..."
  24.   locate 4,10: print "1. Show data for a single Messier object"
  25.   locate 5,10: print "2. List all Messier objects in a constellation"  
  26.   locate 6,10: print "3. List all Messier objects of a certain type"  
  27.   locate 7,10: print "4. List all Messier objects"
  28.   locate 8,10: print "5. Quit"
  29.   locate 10,10:print "Select an option (1..5)"
  30.   repeat
  31.     opt$=inkey$
  32.   until opt$>="1" and opt$<="5"
  33.   if opt$="5" then 
  34.     finished=true
  35.   else
  36.     on val(opt$) gosub one_obj,by_const,by_obj_type,all_objs
  37.   end if
  38. wend
  39.  
  40. window close 1
  41. STOP
  42.  
  43. '..return to main menu upon ctrl-c break detection 
  44. ON BREAK GOTO main
  45. BREAK ON
  46.  
  47. SUB display_titles
  48.    '..column headings
  49.    print "M#";tab(10);" MAG";tab(20);" DEC";tab(30);" RA";tab(45);
  50.    print "Object";tab(65);"Constellation"
  51.    print "--";tab(10);" ---";tab(20);" ---";tab(30);" --";tab(45);
  52.    print "------";tab(65);"-------------"
  53. END SUB
  54.  
  55. SUB dm_form$(n,first$)
  56.   '..convert n to hrs/degs & mins format
  57.   '..hrs/degs
  58.   dh$=str$(fix(n))        
  59.   if n<10 then dh$=" 0"+right$(dh$,1)
  60.   x$=dh$+first$
  61.   '..mins
  62.   mins=abs(n-fix(n))*60
  63.   min$=str$(fix(mins))
  64.   if mins<10 then min$=" 0"+right$(min$,1)
  65.   x$=x$+min$+"m"
  66.   '..return string        
  67.   dm_form$=x$
  68. END SUB
  69.  
  70. SUB show_data
  71. SHARED M,MAG,DEC,RA,OBJ$,CONSTEL$
  72.    '..object data
  73.    print "M";M;tab(10);MAG;
  74.    print tab(20);dm_form$(DEC,"d");tab(30);dm_form$(RA,"h");
  75.    print tab(45);OBJ$;tab(65);CONSTEL$
  76. END SUB
  77.  
  78. BREAK STOP
  79. SUB await_return(msg$)
  80.   print
  81.   print msg$
  82.   while inkey$<>chr$(13):wend  
  83. END SUB
  84. BREAK ON
  85.  
  86. '*************************************
  87.  
  88. one_obj:
  89.  '..display data about 1 Messier object.
  90.  cls
  91.  
  92.  locate 2,10:input "Enter Messier number: ",mes_num
  93.  
  94.  REPEAT
  95.   READ M, DEC, RA, MAG, OBJ$, CONSTEL$ 
  96.  UNTIL M = mes_num or M = sentinel
  97.  
  98.  if M <> mes_num or M = sentinel then 
  99.    locate 4,10:print "M";mes_num;"not found."
  100.  else
  101.    cls
  102.    display_titles
  103.    show_data
  104.  end if
  105.  
  106.  await_return("Hit <return> for menu...")
  107. RETURN
  108.  
  109. '*************************************
  110.  
  111. by_const:
  112.   '..display data about objects in a given constellation.
  113.   cls
  114.   locate 2,10
  115.   input "Enter name of constellation: ",target$
  116.   target$=ucase$(target$)
  117.  
  118.   obj_count=0
  119.   found=false
  120.  
  121.   cls
  122.   display_titles
  123.  
  124.   repeat
  125.     READ M, DEC, RA, MAG, OBJ$, CONSTEL$   
  126.     CONSTEL$=ucase$(CONSTEL$)   
  127.     if (instr(CONSTEL$,target$)or instr(target$,CONSTEL$)) and M<>sentinel then 
  128.       ++obj_count
  129.       found=true
  130.       show_data
  131.     end if
  132.     if obj_count = max_lines then
  133.       await_return("Hit <return> to continue...")
  134.       cls
  135.       display_titles
  136.       obj_count=0
  137.     end if  
  138.   until M = sentinel  
  139.  
  140.   if not found then 
  141.     print "No Messier objects were found in ";target$;"."
  142.   end if
  143.  
  144.   await_return("Hit <return> for menu...")
  145. RETURN
  146.  
  147. '*************************************
  148.  
  149. by_obj_type:
  150.   '..display data about objects of a given type.
  151.   cls
  152.   locate 2,10: PRINT "Object types..."
  153.   locate 4,10: PRINT "1. Diffuse Nebula"
  154.   locate 5,10: PRINT "2. Planetary Nebula" 
  155.   locate 6,10: PRINT "3. Globular Cluster"
  156.   locate 7,10: PRINT "4. Open Cluster"
  157.   locate 8,10: PRINT "5. Spiral Galaxy"
  158.   locate 9,10: PRINT "6. Elliptical Galaxy"
  159.   locate 10,10:PRINT "7. Irregular Galaxy"
  160.   locate 11,10:PRINT "8. None"
  161.   locate 13,10:PRINT "Select option (1..8)"
  162.   BREAK STOP
  163.   repeat
  164.     opt$=inkey$
  165.   until opt$>="1" and opt$<="8"
  166.   BREAK ON
  167.   opt=val(opt$)
  168.  
  169.   case
  170.     opt=1 : target$="Diffuse Nebula" 
  171.     opt=2 : target$="Planetary Nebula" 
  172.     opt=3 : target$="Globular Cluster" 
  173.     opt=4 : target$="Open Cluster" 
  174.     opt=5 : target$="Spiral Galaxy" 
  175.     opt=6 : target$="Elliptical Galaxy" 
  176.     opt=7 : target$="Irregular Galaxy" 
  177.     opt=8 : return
  178.   end case
  179.  
  180.   obj_count=0
  181.   found=false
  182.  
  183.   cls
  184.   display_titles
  185.  
  186.   repeat
  187.     READ M, DEC, RA, MAG, OBJ$, CONSTEL$      
  188.     if OBJ$ = target$ and M <> sentinel then 
  189.       ++obj_count
  190.       found=true
  191.       show_data
  192.     end if
  193.     if obj_count = max_lines then
  194.       await_return("Hit <return> to continue...")
  195.       cls
  196.       display_titles
  197.       obj_count=0
  198.     end if  
  199.   until M = sentinel  
  200.  
  201.   if not found then 
  202.     print "No Messier objects of type: ";target$;" were found."
  203.   end if
  204.  
  205.   await_return("Hit <return> for menu...")
  206. RETURN
  207.  
  208. '*************************************
  209.  
  210. all_objs:
  211.  '..display data about all Messier objects.
  212.  obj_count=0
  213.  
  214.  cls
  215.  display_titles
  216.  
  217.  REPEAT
  218.   READ M, DEC, RA, MAG, OBJ$, CONSTEL$ 
  219.   if M <> sentinel then 
  220.     show_data
  221.     ++obj_count
  222.     if obj_count = max_lines then
  223.       await_return("Hit <return> to continue...")
  224.       cls
  225.       display_titles
  226.       obj_count=0
  227.     end if  
  228.   end if
  229.  UNTIL M = sentinel
  230.  
  231.  await_return("Hit <return> for menu...")
  232. RETURN
  233.  
  234. '************ Messier Data ********************* 
  235.  DATA 1,21.59,05.31,9,"Diffuse Nebula","Taurus" 
  236.  DATA 2,-01.03,21.31,7,"Globular Cluster","Aquarius" 
  237.  DATA 3,28.38,13.40,7,"Globular Cluster","Canes Vena" 
  238.  DATA 4,-26.24,16.21,6,"Globular Cluster","Scorpio" 
  239.  DATA 5,02.16,15.16,6,"Globular Cluster","Serp Caput" 
  240.  DATA 6,-32.11,17.37,6,"Diffuse Nebula","Sagittar" 
  241.  DATA 7,-34.48,17.51,5,"Open Cluster","Scorpio" 
  242.  DATA 8,-24.23,18.01,0,"Diffuse Nebula","Sagittar" 
  243.  DATA 9,-18.28,17.62,8,"Globular Cluster","Ophiuchus" 
  244.  DATA 10,-04.02,16.55,7,"Globular Cluster","Ophiuchus" 
  245.  DATA 11,-06.20,18.48,6,"Open Cluster","Scutum" 
  246.  DATA 12,-01.52,16.45,7,"Globular Cluster","Ophiuchus" 
  247.  DATA 13,36.33,16.40,6,"Globular Cluster","Hercules" 
  248.  DATA 14,-03.13,17.35,9,"Globular Cluster","Ophiuchus" 
  249.  DATA 15,11.57,21.28,7,"Globular Cluster","Pegasus" 
  250.  DATA 16,-13.48,18.16,7,"Open Cluster","Serp Cauda" 
  251.  DATA 17,-16.12,18.18,7,"Diffuse Nebula","Sagittar" 
  252.  DATA 18,-17.09,18.17,7,"Open Cluster","Sagittar" 
  253.  DATA 19,-26.11,16.59,8,"Globular Cluster","Ophiuchus" 
  254.  DATA 20,-23.02,17.59,0,"Diffuse Nebula","Sagittar" 
  255.  DATA 21,-22.30,18.02,7,"Open Cluster","Sagittar" 
  256.  DATA 22,-23.58,18.33,6,"Globular Cluster","Sagittar" 
  257.  DATA 23,-19.01,17.54,7,"Open Cluster","Sagittar" 
  258.  DATA 24,-18.30,18.14,5,"Open Cluster","Sagittar" 
  259.  DATA 25,-19.17,18.29,6,"Open Cluster","Sagittar" 
  260.  DATA 26,-09.27,18.43,8,"Open Cluster","Scutum" 
  261.  DATA 27,22.35,19.58,8, "Planetary Nebula","Vulpecula" 
  262.  DATA 28,-24.54,18.22,8,"Globular Cluster","Sagittar" 
  263.  DATA 29,38.22,20.22,7,"Open Cluster","Cygnus" 
  264.  DATA 30,-23.25,21.38,8,"Globular Cluster","Capricorn" 
  265.  DATA 31,41.00,00.40,4,"Spiral Galaxy","Andromeda" 
  266.  DATA 32,40.36,00.40,9,"Elliptical Galaxy","Andromeda" 
  267.  DATA 33,30.24,01.31,6,"Spiral Galaxy","Triangulm" 
  268.  DATA 34,42.34,02.39,6,"Open Cluster","Perseus" 
  269.  DATA 35,24.21,06.06,6,"Open Cluster","Gemini" 
  270.  DATA 36,34.06,05.33,6,"Open Cluster","Auriga" 
  271.  DATA 37,32.32,05.49,6,"Open Cluster","Auriga" 
  272.  DATA 38,35.48,05.25,7,"Open Cluster","Auriga" 
  273.  DATA 39,48.13,21.30,5,"Open Cluster","Cygnus" 
  274.  DATA 40,58.05,12.22,9,"Double Star ","Ursa Major" 
  275.  DATA 41,-20.41,06.45,6,"Open Cluster","Canis Ma" 
  276.  DATA 42,-05.25,05.33,0,"Diffuse Nebula","Orion" 
  277.  DATA 43,-05.18,05.33,0,"Diffuse Nebula","Orion" 
  278.  DATA 44,20.10,08.37,4,"Open Cluster","Cancer" 
  279.  DATA 45,23.57,03.44,2,"Open Cluster","Taurus" 
  280.  DATA 46,-14.42,07.40,7,"Open Cluster","Puppis" 
  281.  DATA 47,-14.22,07.34,5,"Open Cluster","Puppis" 
  282.  DATA 48,-05.38,08.11,6,"Open Cluster","Hydra" 
  283.  DATA 49,08.16,12.27,9,"Elliptical Galaxy","Virgo" 
  284.  DATA 50,-08.16,7.01,6,"Open Cluster","Monoceros" 
  285.  DATA 51,47.27,13.28,9,"Spiral Galaxy","Canes Vena" 
  286.  DATA 52,61.19,23.22,8,"Open Cluster","Cassiopeia" 
  287.  DATA 53,18.26,13.11,8,"Globular Cluster","Coma Beren" 
  288.  DATA 54,-30.32,18.52,8,"Globular Cluster","Sagittar" 
  289.  DATA 55,-31.03,19.37,6,"Globular Cluster","Sagittar" 
  290.  DATA 56,30.05,19.15,9,"Globular Cluster","Lyra" 
  291.  DATA 57,32.58,18.52,9,"Planetary Nebula","Lyra" 
  292.  DATA 58,12.05,12.35,10,"Spiral Galaxy","Virgo" 
  293.  DATA 59,11.55,12.40,10,"Elliptical Galaxy","Virgo" 
  294.  DATA 60,11.49,12.41,10,"Elliptical Galaxy","Virgo" 
  295.  DATA 61,04.45,12.19,10,"Spiral Galaxy","Virgo" 
  296.  DATA 62,-30.03,16.58,7,"Globular Cluster","Ophiuchus" 
  297.  DATA 63,42.17,13.14,9,"Spiral Galaxy","Canes Vena" 
  298.  DATA 64,21.57,12.54,8,"Spiral Galaxy","Coma Beren" 
  299.  DATA 65,13.23,11.16,10,"Spiral Galaxy","Leo" 
  300.  DATA 66,13.17,11.18,9,"Spiral Galaxy","Leo" 
  301.  DATA 67,12.00,08.49,7,"Open Cluster","Cancer" 
  302.  DATA 68,-26.29,12.37,9,"Globular Cluster","Hydra" 
  303.  DATA 69,-32.23,18.28,8,"Globular Cluster","Sagittar" 
  304.  DATA 70,-32.12,18.40,8,"Globular Cluster","Sagittar" 
  305.  DATA 71,18.39,19.52,8,"Globular Cluster","Sagitta" 
  306.  DATA 72,-12.44,20.51,9,"Globular Cluster","Aquarius" 
  307.  DATA 73,-12.50,20.56,0,"(Four Stars)","Aquarius" 
  308.  DATA 74,15.32,01.34,10,"Spiral Galaxy","Pisces" 
  309.  DATA 75,-22.04,20.03,9,"Globular Cluster","Sagittar" 
  310.  DATA 76,51.19,01.39,11,"Planetary Nebula","Perseus" 
  311.  DATA 77,-00.14,02.40,10,"Spiral Galaxy","Cetus" 
  312.  DATA 78,00.02,05.44,8,"Diffuse Nebula","Orion" 
  313.  DATA 79,-24.34,05.22,8,"Globular Cluster","Lepus" 
  314.  DATA 80,-22.52,16.14,8,"Globular Cluster","Scorpio" 
  315.  DATA 81,69.18,09.52,7,"Spiral Galaxy","Ursa Major" 
  316.  DATA 82,69.56,09.52,9,"Irregular Galaxy","Ursa Major" 
  317.  DATA 83,-29.37,13.34,8,"Spiral Galaxy","Hydra" 
  318.  DATA 84,13.10,12.23,10,"Elliptical Galaxy","Virgo" 
  319.  DATA 85,18.28,12.23,10,"Elliptical Galaxy","Coma Beren" 
  320.  DATA 86,13.13,12.24,10,"Elliptical Galaxy","Virgo" 
  321.  DATA 87,12.40,12.28,10,"Elliptical Galaxy","Virgo" 
  322.  DATA 88,14.42,12.30,10,"Spiral Galaxy","Coma Beren" 
  323.  DATA 89,12.50,12.33,11,"Elliptical Galaxy","Virgo" 
  324.  DATA 90,13.26,12.34,10,"Spiral Galaxy","Virgo" 
  325.  DATA 91,14.30,12.35,9,"Unexplained ","Coma Beren" 
  326.  DATA 92,43.12,17.16,7,"Globular Cluster","Hercules" 
  327.  DATA 93,-23.45,07.43,6,"Open Cluster","Puppis" 
  328.  DATA 94,41.23,12.49,9,"Spiral Galaxy","Canes Vena" 
  329.  DATA 95,11.58,10.41,10,"Spiral Galaxy","Leo" 
  330.  DATA 96,12.05,10.44,10,"Spiral Galaxy","Leo" 
  331.  DATA 97,55.18,11.12,11,"Planetary Nebula","Ursa Major" 
  332.  DATA 98,15.11,12.11,10,"Spiral Galaxy","Coma Beren" 
  333.  DATA 99,14.42,12.16,10,"Spiral Galaxy","Coma Beren" 
  334.  DATA 100,16.06,12.20,10,"Spiral Galaxy","Coma Beren" 
  335.  DATA 101,54.35,14.01,8,"Spiral Galaxy","Ursa Major" 
  336.  DATA 103,60.26,01.30,7,"Open Cluster","Cassiopeia" 
  337.  DATA 104,-11.21,12.37,8,"Spiral Galaxy","Virgo" 
  338.  DATA 105,12.51,10.45,10,"Elliptical Galaxy","Leo" 
  339.  DATA 106,47.35,12.17,9,"Spiral Galaxy","Canes Vena" 
  340.  DATA 107,-12.57,16.30,9,"Globular Cluster","Ophiuchus" 
  341.  DATA 108,55.57,11.09,10,"Spiral Galaxy","Ursa Major" 
  342.  DATA 109,53.39,11.55,10,"Spiral Galaxy","Ursa Major" 
  343.  DATA -1,0,0,0,"",""    '..sentinel
  344.