DEFINT AZ DECLARE SUB VectorPlot (posns%(), reflec%, vctr%) DECLARE SUB Mutate (BioMorphs%

---
Master Index Current Directory Index Go to SkepticTank Go to Human Rights activist Keith Henson Go to Scientology cult

Skeptic Tank!

DEFINT A-Z DECLARE SUB VectorPlot (posns%(), reflec%, vctr%) DECLARE SUB Mutate (BioMorphs%(), popn%) DECLARE SUB BP2 (posns%(), BioMorphs%(), Bio%) DECLARE SUB Choose (BioMorphs%(), popn%) DECLARE SUB BioPlot (posns%(), BioMorphs%(), popn%) CLS PRINT "浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様" PRINT " " PRINT " BIOMURFFS " PRINT " 陳陳陳陳 " PRINT " " PRINT " VERSION 1.3 " PRINT " " PRINT " D.J. Murphy " PRINT " 12th May 1988 " PRINT "把陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳陳" PRINT " " PRINT " " PRINT " This program is based on the one Richard Dawkins describes in his book " PRINT " 'The Blind Watchmaker'. If you want to know what each bit does, read the " PRINT " file 'BIO.DOC' which will describe how the data is coded and used. " PRINT " If, however, you just want to see the computer drawing pretty patterns, " PRINT " the questions you are asked in the program are self explanatory once you " PRINT " get going. In order to get the hang of it, use the default starting genes " PRINT " which means replying N to the second two questions. " PRINT " " PRINT "藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様" ' ' Subroutine MAIN ' This is the main segment of the biomurff program, controlling the operation ' of the other routines ' OPTION BASE 1 DIM BioMorphs%(16, 9), posns%(2048, 4) LOCATE 23, 3 INPUT "Do you want to define the initial gene values yourself "; Reply$ CLS SCREEN 2 ' IF UCASE$(LEFT$(Reply$, 1)) = "Y" THEN PRINT "The genes control biomorph phenotypes as follows:" PRINT PRINT "1: # of offspring" PRINT "2: # of iterations in drawing" PRINT "3: branch length 1" PRINT "4: branch length 2" PRINT "5: branch length combination" PRINT "6: angle (degrees) of 1st branch from stem" PRINT "7: angle (degrees) of 2nd branch from 1st" PRINT "8: length of initial branch" PRINT FOR Bio% = 1 TO 8 PRINT "Gene "; Bio%; INPUT " Value "; BioMorphs%(1, Bio%) NEXT ELSE PRINT "The default initial values are:" PRINT "6,2,8,1,2,135,90,10" PRINT INPUT "Do you want these or a random selection "; Reply$ IF UCASE$(LEFT$(Reply$, 1)) = "R" THEN RANDOMIZE TIMER BioMorphs%(1, 1) = INT(RND * 16) + 1 BioMorphs%(1, 2) = INT(RND * 8) BioMorphs%(1, 3) = INT(RND * 8) + 1 BioMorphs%(1, 4) = INT(RND * 8) + 1 BioMorphs%(1, 5) = INT(RND * 2) + 1 BioMorphs%(1, 6) = INT(RND * 360) + 1 BioMorphs%(1, 7) = INT(RND * 360) + 1 BioMorphs%(1, 8) = INT(RND * 50) + 1 ' FOR Bio% = 1 TO 8 PRINT Bio%; ": "; BioMorphs%(1, Bio%) NEXT ELSE BioMorphs%(1, 1) = 6 BioMorphs%(1, 2) = 2 BioMorphs%(1, 3) = 8 BioMorphs%(1, 4) = 1 BioMorphs%(1, 5) = 2 BioMorphs%(1, 6) = 135 BioMorphs%(1, 7) = 90 BioMorphs%(1, 8) = 10 PRINT "Default values used" END IF END IF ' PRINT PRINT "To end at any point, just press RETURN on it's own to the" PRINT "'Which biomorph do you want ?' prompt." PRINT FOR Bio% = 1 TO 8 FOR popn% = 2 TO BioMorphs%(1, 1) BioMorphs%(popn%, Bio%) = BioMorphs%(1, Bio%) NEXT NEXT INPUT "Press RETURN to show this biomorph "; Reply$ CLS popn% = 1 CALL BioPlot(posns%(), BioMorphs%(), popn%) LOCATE 1, 1 INPUT "Press RETURN to start "; Reply$ popn% = BioMorphs%(1, 1) CLS DO CALL Mutate(BioMorphs%(), popn%) CALL BioPlot(posns%(), BioMorphs%(), popn%) DO LOCATE 1, 1 PRINT " " LOCATE 1, 1 INPUT "Do you want to see any of these alone "; Reply$ IF UCASE$(LEFT$(Reply$, 1)) = "Y" THEN DO LOCATE 1, 1 PRINT " " LOCATE 1, 1 INPUT "Which one do you want "; choice% LOOP UNTIL choice% >= 1 AND choice% <= popn% CLS CALL BP2(posns%(), BioMorphs%(), choice%) LOCATE 1, 1 PRINT " " LOCATE 1, 1 INPUT "Press RETURN to continue "; rep$ CLS CALL BioPlot(posns%(), BioMorphs%(), popn%) END IF LOOP UNTIL UCASE$(LEFT$(Reply$, 1)) <> "Y" CALL Choose(BioMorphs%(), popn%) popn% = BioMorphs%(1, 1) CLS LOOP UNTIL popn% = 0 END DEFSNG A-Z SUB BioPlot (posns%(), BioMorphs%(), popn%) STATIC presntbase%, oldbase%, itn%, Bio% FOR Bio% = 1 TO popn% IF Bio% < 9 THEN IF Bio% / 2 = INT(Bio% / 2) THEN y% = 70 ELSE y% = 85 END IF x% = 50 + ((Bio% - 1) * 80) ELSE IF Bio% / 2 = INT(Bio% / 2) THEN y% = 150 ELSE y% = 165 END IF x% = 50 + ((Bio% - 9) * 80) END IF reflec% = x% LINE (x%, y%)-(x%, (y% - BioMorphs%(Bio%, 8))) posns%(1, 1) = x%: posns%(1, 2) = y% posns%(1, 3) = BioMorphs%(Bio%, 8): posns%(1, 4) = 90 posns%(2, 2) = (y% - BioMorphs%(Bio%, 8)): posns%(2, 1) = x% IF BioMorphs%(Bio%, 5) / 2 = INT(BioMorphs%(Bio%, 5) / 2) THEN posns%(2, 3) = BioMorphs%(Bio%, 3) + BioMorphs%(Bio%, 4) ELSE posns%(2, 3) = BioMorphs%(Bio%, 3) * BioMorphs%(Bio%, 4) END IF posns%(2, 4) = BioMorphs%(Bio%, 6) presntbase% = 2 CALL VectorPlot(posns%(), reflec%, presntbase%) oldbase% = 2 FOR itn% = 1 TO BioMorphs%(Bio%, 2) presntbase% = 2 ^ itn% + 1 count% = presntbase% FOR vector% = oldbase% TO (presntbase% - 1) xroot% = posns%(vector%, 1) - posns%(vector%, 3) * SIN(posns%(vector%, 4) / 6.28319) yroot% = posns%(vector%, 2) + posns%(vector%, 3) * COS(posns%(vector%, 4) / 6.28319) posns%(count%, 1) = xroot% posns%(count%, 2) = yroot% IF BioMorphs%(Bio%, 5) / 2 = INT(BioMorphs%(Bio%, 5) / 2) THEN posns%(count%, 3) = BioMorphs%(Bio%, 3) + BioMorphs%(Bio%, 4) ELSE posns%(count%, 3) = BioMorphs%(Bio%, 3) * BioMorphs%(Bio%, 4) END IF posns%(count%, 4) = BioMorphs%(Bio%, 6) CALL VectorPlot(posns%(), reflec%, count%) count% = count% + 1 posns%(count%, 1) = xroot% posns%(count%, 2) = yroot% IF BioMorphs%(Bio%, 5) / 2 = INT(BioMorphs%(Bio%, 5) / 2) THEN posns%(count%, 3) = BioMorphs%(Bio%, 3) + BioMorphs%(Bio%, 4) ELSE posns%(count%, 3) = BioMorphs%(Bio%, 3) * BioMorphs%(Bio%, 4) END IF posns%(count%, 4) = BioMorphs%(Bio%, 7) - BioMorphs%(Bio%, 6) CALL VectorPlot(posns%(), reflec%, count%) count% = count% + 1 NEXT oldbase% = presntbase% NEXT NEXT END SUB SUB BP2 (posns%(), BioMorphs%(), Bio%) STATIC presntbase%, oldbase%, itn% x% = 320 reflec% = 320 y% = 125 LOCATE 1, 1 INPUT "What magnification do you want "; magn LINE (x%, y%)-(x%, (y% - (magn * BioMorphs%(Bio%, 8)))) posns%(1, 1) = x%: posns%(1, 2) = y% posns%(1, 3) = BioMorphs%(Bio%, 8) * magn posns%(2, 2) = (y% - (magn * BioMorphs%(Bio%, 8))): posns%(2, 1) = x% IF BioMorphs%(Bio%, 5) / 2 = INT(BioMorphs%(Bio%, 5) / 2) THEN posns%(2, 3) = magn * (BioMorphs%(Bio%, 3) + BioMorphs%(Bio%, 4)) ELSE posns%(2, 3) = magn * (BioMorphs%(Bio%, 3) * BioMorphs%(Bio%, 4)) END IF posns%(2, 4) = BioMorphs%(Bio%, 6) presntbase% = 2 CALL VectorPlot(posns%(), reflec%, presntbase%) oldbase% = 2 FOR itn% = 1 TO BioMorphs%(Bio%, 2) presntbase% = 2 ^ itn% + 1 count% = presntbase% FOR vector% = oldbase% TO (presntbase% - 1) xroot% = posns%(vector%, 1) - posns%(vector%, 3) * SIN(posns%(vector%, 4) / 6.28319) yroot% = posns%(vector%, 2) + posns%(vector%, 3) * COS(posns%(vector%, 4) / 6.28319) posns%(count%, 1) = xroot% posns%(count%, 2) = yroot% IF BioMorphs%(Bio%, 5) / 2 = INT(BioMorphs%(Bio%, 5) / 2) THEN posns%(count%, 3) = magn * (BioMorphs%(Bio%, 3) + BioMorphs%(Bio%, 4)) ELSE posns%(count%, 3) = magn * (BioMorphs%(Bio%, 3) * BioMorphs%(Bio%, 4)) END IF posns%(count%, 4) = BioMorphs%(Bio%, 6) CALL VectorPlot(posns%(), reflec%, count%) count% = count% + 1 posns%(count%, 1) = xroot% posns%(count%, 2) = yroot% IF BioMorphs%(Bio%, 5) / 2 = INT(BioMorphs%(Bio%, 5) / 2) THEN posns%(count%, 3) = magn * (BioMorphs%(Bio%, 3) + BioMorphs%(Bio%, 4)) ELSE posns%(count%, 3) = magn * (BioMorphs%(Bio%, 3) * BioMorphs%(Bio%, 4)) END IF posns%(count%, 4) = BioMorphs%(Bio%, 7) - BioMorphs%(Bio%, 6) CALL VectorPlot(posns%(), reflec%, count%) count% = count% + 1 NEXT oldbase% = presntbase% NEXT LOCATE 12, 1 PRINT "Biomorph gene values:" FOR itn% = 1 TO 8 PRINT itn%; " : "; BioMorphs%(Bio%, itn%) NEXT END SUB SUB Choose (BioMorphs%(), popn%) STATIC Reply$, choice%, count1%, count2% DO LOCATE 1, 1 PRINT " " LOCATE 1, 1 INPUT "Please enter the number of the biomorph you want "; choice% LOOP UNTIL choice% <= popn% IF choice% = 0 THEN BioMorphs%(1, 1) = 0 ELSE FOR count1% = 1 TO 16 FOR count2% = 1 TO 8 BioMorphs%(count1%, count2%) = BioMorphs%(choice%, count2%) NEXT NEXT END IF END SUB SUB Mutate (BioMorphs%(), popn%) STATIC mut.gen, mg%, Bio% RANDOMIZE TIMER FOR Bio% = 1 TO popn% mut.gen = RND mg% = INT(mut.gen * 9) + 1 mut.gen = RND IF mut.gen < .5 THEN BioMorphs%(Bio%, mg%) = BioMorphs%(Bio%, mg%) - 1 IF BioMorphs%(Bio%, mg%) = 0 THEN BioMorphs%(Bio%, mg%) = 2 END IF ELSE BioMorphs%(Bio%, mg%) = BioMorphs%(Bio%, mg%) + 1 END IF IF BioMorphs%(Bio%, 1) = 17 THEN BioMorphs%(Bio%, 1) = 16 IF BioMorphs%(Bio%, 2) = 11 THEN BioMorphs%(Bio%, 2) = 10 IF BioMorphs%(Bio%, 3) = 9 THEN BioMorphs%(Bio%, 3) = 8 IF BioMorphs%(Bio%, 4) = 9 THEN BioMorphs%(Bio%, 4) = 8 NEXT END SUB SUB VectorPlot (posns%(), reflec%, vctr%) STATIC x%, y%, x1% x% = posns%(vctr%, 1) - posns%(vctr%, 3) * SIN(posns%(vctr%, 4) / 6.28319) y% = posns%(vctr%, 2) + posns%(vctr%, 3) * COS(posns%(vctr%, 4) / 6.28319) LINE (posns%(vctr%, 1), posns%(vctr%, 2))-(x%, y%), 15 x% = 2 * reflec% - x% x1% = 2 * reflec% - posns%(vctr%, 1) LINE (x1%, posns%(vctr%, 2))-(x%, y%), 15 END SUB

---

E-Mail Fredric L. Rice / The Skeptic Tank