Biorhythms

Author(s): Doug McRoy
Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v5 n1 (Volume 5, Issue 1)
Date: January 1984
Pages: 9-11

I wrote this program as a result of a great disappointment I experienced after purchasing a Biorhythms program from one of the prominent software companies. The program did not print an accurate set of curves, and did not print a mathematically correct result.

I developed a printing routine first, which works on a PLOT, PRINT, UNPLOT basis, allowing a sine plot made of letters. The positive half of the curve usually prints first, then the rest of the curve in reverse (negative STEP).

Biorhythms computes time (T) in days and divides it by each cycle length to get the number of cycles since birth. It decides where to print each curve by converting the fraction of each cycle remaining to X PLOT coordinates (J) relative to the date line. The date line displays 2 pixels offset (column 16) to make it read accurately.

With 15 days on each side of the graph date, the completed chart represents a 31-day time spread, Relevant information appears at the top and bottom of the display, for a permanent record if you COPY.

Each date displays after INPUT. After you enter a name, Biorhythms goes into fast mode, usually making the time and offset computations in under 3.5 seconds. The graph printing, taking about a minute and a half, is rather interesting to watch (you wonder where the next curve will hit).

After typing the program, SAVE it with GOTO 1000. It will run as soon as SAVEing completes and after LOADing. Prompts are adequate, but if the program stops a simple “GOTO 150” will bring it right back.

Important variables:

T = Time in days
W = Number of cycles since birth
J = Sets start pt of sin print
L = Sets start pt of back print
Lines 5-45.......Intro display
Lines 145-275....Prompts and Input
Lines 297-360....Graph Print + Info
Lines 370-600....Sin Print P,E,I
Lines 610-710....More prompts and
                 terminate display
Lines 820-885....Time Computation
Lines 890-986....X-Axis Offset
                 Computations

This program uses up about 6.2K of RAM. I have an enhanced version with more user-friendliness and error-trapping features that also prints out a compatibility factor between two persons when given the birth dates of each, within a 10% range for each curve. It uses a little more than 15K of RAM and includes a brief explanation of biorhythm theory.

I will furnish the extended 15K version by mail to anyone for $10.00 post paid.

Doug McRoy
5 Pfister St
Laurel, MD 20707

3 REM BIORHYTHM PROGRAM
5 PRINT AT 3,8;"████▖ ▐█▌ ▟███▙"
6 PRINT AT 4,8;"█ ▝█ █ █▘ ▝█"
7 PRINT AT 5,8;"█ ▗█ █ █ █"
8 PRINT AT 6,8;"████▌ █ █ █ ██"
9 PRINT AT 7,8;"█ ▝█ █ █ █"
10 PRINT AT 8,8;"█ ▗█ █ █▖ ▗█"
11 PRINT AT 9,8;"████▘ ▐█▌ ▜███▛"
12 PRINT AT 11,1;"███▙ █ ▐▌█ █▐███▌█ ▐▌█▌ ▐█"
13 PRINT AT 12,1;"█ ▜▌█ ▐▌▜▌ ▐▛ █ █ ▐▌██▄██"
14 PRINT AT 13,1;"█ ▐▌█ ▐▌▝█ █▘ █ █ ▐▌█▝█▘█"
15 PRINT AT 14,1;"█ ▟▘████▌ ▜█▛ █ ████▌█ █"
16 PRINT AT 15,1;"███▌ █ ▐▌ ▝█▘ █ █ ▐▌█ █"
17 PRINT AT 16,1;"█ ▜▖ █ ▐▌ █ █ █ ▐▌█ █"
18 PRINT AT 17,1;"█ ▜▌█ ▐▌ █ █ █ ▐▌█ █"
20 FOR N=1 TO 64 STEP 2
25 PLOT N,22+20*SIN (N/32*PI)
30 NEXT N
35 PRINT AT 21,0;"BY DOUG MCROY 1983"
40 FOR I=1 TO 100
45 NEXT I
50 CLS
145 REM INPUT PROMPTS
150 CLS
155 PRINT AT 5,0;"▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"
160 PRINT AT 6,6;"FOR BIORHYTHM CURVES:"
165 PRINT AT 7,0;"▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄"
170 PRINT AT 10,0;"ENTER BIRTH DATE;"
175 PRINT AT 11,5;"MONTH, DAY, AND YEAR."
180 PRINT AT 14,0;"ENTER EACH NUMBER SEPARATELY."
185 INPUT M1
190 INPUT D1
195 INPUT Y1
200 PRINT AT 18,0;M1;"/";D1;"/";Y1
210 PRINT AT 10,0;" "
215 FOR I=1 TO 10
220 NEXT I
225 PRINT AT 10,0;"NOW ENTER DESIRED DATE:"
235 INPUT M2
240 INPUT D2
245 INPUT Y2
250 PRINT AT 19,0;M2;"/";D2;"/";Y2
255 PRINT AT 11,5;" "
260 PRINT AT 10,0;" "
263 PRINT AT 14,0;" "
265 FOR I=1 TO 15
267 NEXT I
270 PRINT AT 10,0;"NOW ENTER NAME "
275 INPUT Z$
280 CLS
285 FAST
290 GOSUB 815
292 REM GRAPH PRINT+INFO
293 SLOW
294 CLS
297 PRINT AT 12,1;"PAST";AT 12,26;"FUTURE"
300 PRINT AT 14,4;"EACH DOT EQUALS ONE DAY."
301 PRINT AT 16,6;"(A 31 DAY GRAPH)"
303 PRINT AT 10,0;" ▖ ▖ ▖ ▖ ▖ ▖"
304 FOR N=1 TO 31
305 PRINT AT 11,N;"▘"
310 NEXT N
315 PRINT AT 14,4;" "
325 PRINT AT 14,2;"VERTICAL LINE";AT 14,17;"IS GRAPH DATE."
327 FOR N=1 TO 19
330 PRINT AT N,16;"▌"
335 NEXT N
336 FOR I=1 TO 20
337 NEXT I
340 PRINT AT 14,0;" ";AT 14,17;" "
341 PRINT AT 16,6;" ▌ "
342 PRINT AT 12,1;" ";AT 12,26;" "
345 PRINT AT 20,0;Z$
350 PRINT AT 21,0;"BORN ";M1;"/";D1;"/";Y1
355 PRINT AT 0,0;"BIORHYTHM FOR";AT 0,13;"(DATE) ";M2;"/";D2;"/";Y2
360 PRINT AT 20,16;"DAYS OLD=";T
368 REM SIN PRINT PHY
370 LET I=23
375 PRINT AT 21,16;"PHYSICAL"
380 LET L=J-2*I
385 FOR N=0 TO 63 STEP 2
390 IF J+N>61 THEN GOTO 420
395 PLOT J+N,22+18*SIN (N/I*PI)
400 PRINT "P"
405 UNPLOT J+N,22+18*SIN (N/I*PI)
410 NEXT N
420 FOR N=43 TO 46-((32-(64-J)/2)*2) STEP -2
425 PLOT L+N,22+18*SIN (N/I*PI)
430 PRINT "P"
435 UNPLOT L+N,22+18*SIN (N/I*PI)
440 NEXT N
447 GOSUB 920
449 REM SIN PRINT EMO
450 LET I=28
455 PRINT AT 21,16;"EMOTIONAL"
460 LET L=J-2*I
465 FOR N=0 TO 63 STEP 2
470 IF J+N>61 THEN GOTO 500
475 PLOT J+N,22+18*SIN (N/I*PI)
480 PRINT "E"
485 UNPLOT J+N,22+18*SIN (N/I*PI)
490 NEXT N
495 PRINT
500 FOR N=53 TO 56-((32-(64-J)/2)*2) STEP -2
505 PLOT L+N,22+18*SIN (N/I*PI)
510 PRINT "E"
515 UNPLOT L+N,22+18*SIN (N/I*PI)
520 NEXT N
527 GOSUB 955
529 REM SIN PRINT INT
530 LET I=33
535 PRINT AT 21,16;"INTELLECTUAL"
540 LET L=J-2*I
545 FOR N=0 TO 63 STEP 2
550 IF J+N>61 THEN GOTO 580
555 PLOT J+N,22+18*SIN (N/I*PI)
560 PRINT "I"
565 UNPLOT J+N,22+18*SIN (N/I*PI)
570 NEXT N
580 FOR N=63 TO 66-((32-(64-J)/2)*2) STEP -2
585 PLOT L+N,22+18*SIN (N/I*PI)
590 PRINT "I"
595 UNPLOT L+N,22+18*SIN (N/I*PI)
600 NEXT N
605 PRINT AT 21,16;" "
610 REM PROMPTS
615 PRINT AT 21,20;"COPY? Y OR N"
620 LET Z$=INKEY$
625 INPUT Z$
630 IF CODE Z$=62 THEN COPY
635 IF CODE Z$=51 THEN GOTO 643
640 IF CODE Z$<>62 OR CODE Z$<>51 THEN GOTO 625
643 PRINT AT 21,0;" RUN PGM AGAIN? Y OR N"
645 LET Z$=INKEY$
650 INPUT Z$
655 IF CODE Z$=62 THEN GOTO 150
660 IF CODE Z$=51 THEN GOTO 675
665 IF CODE Z$<>62 OR CODE Z$<>51 THEN GOTO 650
670 REM TERMINATION DISPLAY
675 CLS
680 PRINT AT 12,7;"HAVE A GOOD DAY..."
685 FOR I=1 TO 25
690 NEXT I
695 FOR I=1 TO 13
700 SCROLL
705 NEXT I
710 STOP
815 REM TIME PERIOD
820 LET P$="303232332323"
825 LET T=(Y2-Y1)*365
830 FOR I=1 TO M1-1
835 LET T=T-CODE P$(I)
840 NEXT I
845 FOR I=1 TO M2-1
850 LET T=T+CODE P$(I)
855 NEXT I
860 LET T=T+D2-D1
865 FOR I=Y1 TO Y2
870 IF 4*INT (I/4)=I THEN LET T=T+1
875 NEXT I
880 IF (Y1=Y2 AND M1<3 AND M2<3) OR M1>2 THEN LET T=T-1
885 LET T=T+1
887 REM X-AXIS OFFSET PHY
890 LET W=T/23
895 LET W=ABS W+INT W
900 IF INT W>0 THEN LET W=ABS W-INT W
905 LET J=W*46
910 IF J<=30 THEN LET J=30-J
915 IF J>30 THEN LET J=46-(J-30)
917 RETURN
920 REM X-AXIS OFFSET EMO
925 LET W=T/28
930 LET W=ABS W+INT W
935 IF INT W>0 THEN LET W=ABS W-INT W
940 LET J=W*56
945 IF J<=30 THEN LET J=30-J
950 IF J>30 THEN LET J=56-(J-30)
953 RETURN
955 REM X-AXIS OFFSET INT
960 LET W=T/33
965 LET W=ABS W+INT W
970 IF INT W>0 THEN LET W=ABS W-INT W
975 LET J=W*66
980 IF J<=30 THEN LET J=30-J
985 IF J>30 THEN LET J=66-(J-30)
986 IF J>63 THEN LET J=J-66
990 RETURN
1000 SAVE "BIORHYTHM"
1005 RUN
SYNTACTIC SUM: 29522, 8K ROM

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.