rem biorythms, today + 4 weeks rem v0.99 dic. 2011 by Antonis rem revised array.load daysofmonth [], 31,28,31,30,31,30,31,31,30,31,30,31 ! coordinates for drawing dim emtx[701],emty[701] dim intlx[701],intly[701] dim physx[701], physy[701] ! 28 days/0.04 space =700 +day 0, require 701 elements for arrays restart: cls PRINT "####################" PRINT "# Biorythms by [Antonis] #" PRINT "# v0.99 Dic.2011 #" PRINT "####################" Input "Your birthday: YYYYMMDD",DD$,"19800527" birthday=VAL(RIGHT$(DD$,2)) birthmonth=VAL(MID$(DD$,5,2)) birthyear=VAL(LEFT$(DD$,4)) time year$,month$,day$,hour$,minute$,second$ year=val(year$) month=val(month$) day=val(day$) ! calculate total days passed ! first years yearspassed=year-birthyear ! then whole months if month<=birthmonth+1 then yearspassed=yearspassed-1 monthspassed=12-birthmonth+month else monthspassed=month-birthmonth endif ! then days ! Add first month's days+whole months days+lastmonth's days firstmonthdays=daysofmonth[birthmonth]-birthday lastmonthdays=0 if day>birthday then lastmonthdays=day else if month=1 then month=13 lastmonthdays=daysofmonth[month-1]+day monthspassed=monthspassed-1 endif dayspassed=0 j=0 index=birthmonth for i=1 to monthspassed-1 j=j+1 if j=13 then j=1 if index+j=13 then index=0 j=1 endif dayspassed=dayspassed+daysofmonth[index+j] next i dayspassed=dayspassed+firstmonthdays+lastmonthdays ! calculate days of leapyears leapyear=0 for i=0 to yearspassed-1 index=birthyear+i if mod((index),4)=0 then leapyear=leapyear+1 if mod((index),4)=0 & birthmonth>2 & index=birthyear then leapyear=leapyear-1 next i if mod((year),4)=0 & month>2 & birthmonth>2 then leapyear=leapyear+1 ! total days daystotal=dayspassed+yearspassed*365+leapyear ! calculate periods physical=23 emotional=28 intellectual=33 currentphys=mod(daystotal,physical) currentemot=mod(daystotal,emotional) currentintel=mod(daystotal,intellectual) print "Your age in days: ";daystotal print " Please wait, calculating..." ! 28+1 days count j=0 k=0 ! here 14, 0,02 for i=0 to 28 step 0.04 j=j+1 physx[j]=i x=currentphys+i if x>physical then x=currentphys+i-physical x=x/physical x=x*2*3.1459 physy[j]=sin(x) emtx[j]=i y=currentemot+i if y>emotional then y=currentemot+i-emotional y=y/emotional y=y*2*3.1459 emty[j]=sin(y) intlx[j]=i z=currentintel+i if z>=intellectual then z=currentintel+i-intellectual z=z/intellectual z=z*2*3.1459 intly[j]=sin(z) next i print "ok" gr.open 255,0,0,0 gr.orientation 1 pause 1000 ! draw in 800x1280 and scale GR.screen w, h scalex = w / 800 scaley = h / 1280 GR.scale scalex, scaley gr.set.stroke 4 gr.color 255,255,255,255,1 gr.text.size 40 gr.text.draw tobj,50,100,"Biorythms for "+dd$ gr.text.draw tobj,50,150,"Starting from month: "+month$+" day: "+day$ gr.line lobj, 0,400,800,400 gr.line lobj, 0,600,800,600 gr.line lobj, 0,200,800,200 gr.set.stroke 0 gr.color 255,100,100,100,1 for i=0 to 28 gr.line lobj, (57.142857143/2)*i,200, (57.142857143/2)*i,600 next i gr.color 255,0,0,255,1 ! blue physical gr.set.stroke 4 gr.line lobj,0,800,100,800 gr.text.draw tobj,100,800," Physical" for i=1 to 701 physx[i]= (57.142857143/2)*physx[i] physy[i]=400-physy[i]*200 if i>1 then gr.line lobj,physx[i-1],physy[i-1], physx[i],physy[i] endif next i gr.render gr.color 255,255,0,0,1 gr.line lobj,0,900,100,900 gr.text.draw tobj,100,900," Emotional" ! red emotional for i=1 to 701 emtx[i]= (57.142857143/2)*emtx[i] emty[i]=400-emty[i]*200 if i>1 then gr.line lobj,emtx[i-1],emty[i-1], emtx[i],emty[i] endif next i gr.render gr.color 255,0,255,0,1 gr.line lobj,0,1000,100,1000 gr.text.draw tobj,100,1000," Intellectual" ! green intellectual for i=1 to 701 intlx[i]= (57.142857143/2)*intlx[i] intly[i]=400-intly[i]*200 if i>1 then gr.line lobj,intlx[i-1],intly[i-1], intlx[i],intly[i] endif next i gr.color 255,100,100,100,1 gr.text.draw tobj,100,1100," Touch Screen to continue!" gr.text.draw tobj,100,1200," Back to quit!" gr.render DO touched = -1 GR.touch touched, x, y UNTIL touched>0 gr.cls gr.close goto restart end