1 REM  //  auspice.bas
2 REM  //  BASIC program by Richard Uyeyama (ruyeyama@best.com)
3 REM  //  V1.0  5/15/96
4 REM  //
5 REM  //  Copyright 1996 by Richard Uyeyama.
6 REM  //  Permission granted by author to duplicate and distribute this
7 REM  //  program in its entirity (including credits and comments), for
8 REM  //  non-commercial, non-profit purposes only.
9 REM  //
10 REM //
14 REM //  Given a month, day, and year of birth, this program will
15 REM //  calculate, based upon new moon data from the year 1995,
16 REM //  approximately how many days into the synodic month the
17 REM //  moon was on that date.  From this, the phase of the moon
18 REM //  can be obtained.
19 REM //
20 REM //  Note: Due to inaccuracies which may be present in the numerical
21 REM //  data used to make these calculations, as well the inaccuracies
22 REM //  which may arise from the calculations themselves, the output
23 REM //  from this program should not be taken as being the veritable
24 REM //  absolute truth... at least not without checking a more official
25 REM //  history of moon phases first.
26 REM //
27 REM //  Also note that this program hasn't been "dummy proofed", as far
28 REM //  as the input values it will accept.  So it's possible to feed
29 REM //  it dates that don't exist (Feb 30th... or even Feb 300th), or
30 REM //  otherwise don't make sense.  So please be careful in the values
31 REM //  you input.
32 REM //
33 REM //  Lastly, note that, since the reference points used are from the
34 REM //  year 1995, the program will most likely not produce accurate
35 REM //  output for any date beyond that year.
36 REM //
37 REM //  For more details on the process of calculating moon phase data,
38 REM //  see (http://ruyeyama.best.vwh.net/rage/auspice.html)
39 REM //
40 REM //
50 SYNODICM=42524.064
51 REM //
52 REM //  1 synodic month = 29.5306 days = 42,524.064 minutes
53 REM //  This is the most accurate figure I've found so far...
54 REM //
100 PRINT "What is your MONTH of birth? (1-12)"
110 INPUT BMONTH
150 PRINT "What is your DAY of birth? (1-28/29/30/31)"
160 INPUT BDAY
170 PRINT "What is your YEAR of birth? (4 digits)"
180 INPUT BYEAR
190 YEAR=1995
191 REM //
192 REM //  The program will now determine the date of the new moon
193 REM //  immediately preceding your birthday in 1995.  Here's the
194 REM //  1995 new moon data the program uses: (13 new moons in 1995)
195 REM //     January 1    January 30      March 1       March 31
196 REM //     April 29     May 29          June 28       July 27
197 REM //     August 26    September 24    October 24    November 22
198 REM //     December 22
199 REM //
200 IF BMONTH>1 THEN GOTO 220
205 MONTH=1
210 IF BDAY>29 THEN DAY=30 ELSE DAY=1
215 GOTO 500
220 IF BMONTH>2 THEN GOTO 240
225 MONTH=1
230 DAY=30
235 GOTO 500
240 IF BMONTH>3 THEN GOTO 260
245 MONTH=3
250 IF BDAY>30 THEN DAY=31 ELSE DAY=1
255 GOTO 500
260 IF BMONTH>4 THEN GOTO 280
265 IF BDAY>28 THEN GOTO 270
267 MONTH=3
268 DAY=31
269 GOTO 500
270 MONTH=4
271 DAY=29
275 GOTO 500
280 IF BMONTH>5 THEN GOTO 300
285 IF BDAY>28 THEN GOTO 290
287 GOTO 270
290 MONTH=5
291 DAY=29
295 GOTO 500
300 IF BMONTH>6 THEN GOTO 320
305 IF BDAY>27 THEN GOTO 310
307 GOTO 290
310 MONTH=6
312 DAY=28
315 GOTO 500
320 IF BMONTH>7 THEN GOTO 340
325 IF BDAY>26 THEN GOTO 330
327 GOTO 310
330 MONTH=7
332 DAY=27
335 GOTO 500
340 IF BMONTH>8 THEN GOTO 360
345 IF BDAY>25 THEN GOTO 350
347 GOTO 330
350 MONTH=8
352 DAY=26
355 GOTO 500
360 IF BMONTH>9 THEN GOTO 380
365 IF BDAY>23 THEN GOTO 370
367 GOTO 350
370 MONTH=9
372 DAY=24
375 GOTO 500
380 IF BMONTH>10 THEN GOTO 400
385 IF BDAY>23 THEN GOTO 390
387 GOTO 370
390 MONTH=10
392 DAY=24
395 GOTO 500
400 IF BMONTH>11 THEN GOTO 420
405 IF BDAY>21 THEN GOTO 410
407 GOTO 390
410 MONTH=11
412 DAY=22
415 GOTO 500
420 IF BDAY>21 THEN GOTO 430
425 GOTO 410
430 MONTH=12
432 DAY=22
435 GOTO 500
450 REM //
451 REM //  The program has now found the new moon immediately preceding
452 REM //  your birthday in 1995.
453 REM //
500 PRINT
505 PRINT "Your birthday:            " BMONTH "/" BDAY "/" BYEAR
510 PRINT "Reference point new moon: " MONTH "/" DAY "/" YEAR
511 PRINT
515 REM //
516 REM //  Now the program is going to calculate the number of leap years
517 REM //  it should consider before making its synodic month calculations.
518 REM //
520 YEARD=YEAR-BYEAR
525 LEAPS=0
530 IF YEARD>2 THEN LEAPS=LEAPS+1
532 YEARD=YEARD-3
535 REM //
536 REM //  This checks for the leap year 1992, which is only 3 years
537 REM //  from 1995 (which is different from the regular pattern of
538 REM //  4 years, below), and so has to be dealt with separately.
539 REM //
540 IF YEARD<4 THEN GOTO 565
545 LEAPS=LEAPS+1
550 YEARD=YEARD-4
555 GOTO 540
560 REM //
561 REM //  The number of leap years has been calculated.  Now the number
562 REM //  of actual leap days to be considered has to be calculated.
563 REM //
565 IF YEARD=0 THEN GOTO 575
570 GOTO 600
575 IF MONTH<3 THEN GOTO 600
580 LEAPS=LEAPS-1
595 REM //
596 REM //  The number of leap days has been calculated.
597 REM //
600 PRINT "Number of leap days to consider:" LEAPS
605 PRINT
610 REM //
611 REM //  Now it's time to calculate the number of synodic months there
612 REM //  were between the 1995 new moon and its equivalent date in your
613 REM //  birth year.
614 REM //
615 REM //  I'm doing this here by converting everything to minutes, then
616 REM //  doing the calculations in terms of minutes...
617 REM //
620 YEARS=YEAR-BYEAR
621 REM //
622 REM //  I'd use "YEARD" here, except that its value has changed during
623 REM //  the process of the LEAPS calculation.  So instead, I'm just
624 REM //  using a new variable.
625 REM //
630 MINUTES=YEARS*525600
631 REM //
632 REM //  525,600 minutes/year (365 days * 24 hours * 60 minutes)
633 REM //
635 MINUTES=MINUTES+(LEAPS*1440)
636 REM //
637 REM //  Adding the leap days, converted to minutes by multiplying by
638 REM //  1440 (24 hours * 60 minutes).
639 REM //
640 REM //  Now that we have the number of minutes, we divide that by
641 REM //  SYNODICM (the number of minutes in 1 synodic month) to get
642 REM //  the number of synodic months.
643 REM //
650 CALC=MINUTES/SYNODICM
651 REM //
652 REM //  What we're actually interested in here is not the number of
653 REM //  synodic months, but the *remainder* of this calculation (i.e.
654 REM //  the fraction of a synodic month which is left over).
655 REM //
660 IF CALC<1 THEN GOTO 700
665 IF CALC>100 THEN CALC=CALC-100
670 IF CALC>10 THEN CALC=CALC-10
675 IF CALC>1 THEN CALC=CALC-1
680 GOTO 660
681 REM //
682 REM //  Here, we're just whittling CALC down until only the part
683 REM //  after the decimal is left.  After all, that's all we're really
684 REM //  interested in.  Another way of dealing with things would be to
685 REM //  instead use the number of minutes left over from the MINUTES/
686 REM //  SYNODICM calculation (the remainder from the division).
687 REM //
688 REM //  Now we convert this back into days.  Since the number left over
689 REM //  in CALC is a fraction of a synodic month, we multiply it by
690 REM //  29.5306 (the number of days in a synodic month) to get the
691 REM //  number of days.
692 REM //
693 REM //  Actually, I'll be multiplying by SYNODICM/1440, which is the
694 REM //  same thing.
695 REM //
700 CALC=CALC*(SYNODICM/1440)
701 REM //
702 REM //  Now we have the number of days we're interested in.  But since
703 REM //  these calculations are moving backwards in time, this is
704 REM //  currently the number of days from the *top* of the synodic
705 REM //  cycle.  To get the number of days *into* the synodic month
706 REM //  this day is, we simply subtract from the number of days in
707 REM //  1 synodic month.
708 REM //
710 CALC=(SYNODICM/1440)-CALC
711 REM //
712 REM //  Now we have the number of days into the synodic month for the
713 REM //  day equivalent to the 1995 new moon.  To get the value for
714 REM //  the inputted birthday, we simply add the proper number of
715 REM //  days to this figure.  Of course, we have to calculate that
716 REM //  first...
717 REM //
720 IF BMONTH=MONTH THEN DAYS=BDAY-DAY
725 IF BMONTH>MONTH THEN GOTO 735
730 GOTO 800
735 DAYS=BDAY
740 DAYS=DAYS+(31-DAY)
745 IF MONTH=1 GOTO 800
750 IF MONTH=3 GOTO 800
755 IF MONTH=5 GOTO 800
760 IF MONTH=7 GOTO 800
765 IF MONTH=8 GOTO 800
770 IF MONTH=10 GOTO 800
775 DAYS=DAYS-1
780 IF MONTH=2 THEN DAYS=DAYS-2
790 REM //
791 REM //  Actually, because there were no new moons in February 1995,
792 REM //  the "if month=2" line really isn't necessary, but...  Also,
793 REM //  FYI, there isn't a "if month=12" line above because this
794 REM //  section is only looking at the case where MONTH is not equal
795 REM //  to BMONTH... so MONTH would have to be in November or before.
796 REM //
800 CALC=CALC+DAYS
801 REM //
802 REM //  Now we have the number of days into the synodic month the
803 REM //  actual inputted birthday is.  Now we just check to make sure
804 REM //  that CALC isn't larger than 29.5306 days (1 synodic month).
805 REM //  If it is, we simply subtract that amount from CALC.
806 REM //
810 IF CALC>(SYNODICM/1440) THEN CALC=CALC-(SYNODICM/1440)
815 PRINT
820 PRINT "Your birthday was" CALC "days into the synodic month."
825 PRINT
830 PRINT "The following chart lists values for the phases of the moon,"
835 PRINT "by approximate number of days into the synodic month."
840 PRINT
845 PRINT
850 PRINT " 0     3.69    7.38   11.07  14.77   18.46   22.15   25.84  29.53"
855 PRINT "new  crescent  half  gibbous  full  gibbous  half  crescent  new"
890 PRINT "     (waxing) (wax.)  (wax.)       (waning) (wan.)  (wan.)"
895 PRINT
900 END