Apple Max

 

0 DIM S(45),Q$(1):X=0:Y=1:A=2:L=3:J=4:S(X)=80:S(Y)=80:S(A)=0:S(L)=30:C=10:O=-9999:N=2.7


1 V=0:W=0:M=1:GRAPHICS 7:SETCOLOR 0,1,4:SETCOLOR 1,12,14:SETCOLOR 2,11,4:COLOR 2:CIRCLE C,C,C:PAINT C,C:? "GENE RANGES: D 1-8, F 50-68, R 1-4 "


2 IF O>-9999:? "Hi(";E;",";G;",";K;")";O,;:ENDIF :INPUT "D,F,R? ",D,F,R:IF D<1 OR D>8 OR F<50 OR F>68 OR R<1 OR R>4 THEN M=0


3 IF M=0:? "}}";:GOTO 1:ELSE :GOSUB 5:GOSUB 9:ENDIF :U=W*8*R^N/32 DIV 1:V=V DIV 1:? "sunin=";Q;", leafg=";U;", brang=";V


4 Z=Q-U-V:? "SCORE: ";Z;:IF Z>=0:? " apples";:ELSE :? ", failed";:ENDIF :IF Z>O:E=D:G=F:K=R:O=Z:ENDIF :? ,"Replay";:INPUT Q$ :CLS :GOTO 1


5 IF D>0:COLOR 1:PLOT S(X),S(Y):S(X+5)=S(X)+S(L)*SIN(S(A)):S(Y+5)=S(Y)-S(L)*COS(S(A)):DRAWTO S(X+5),S(Y+5):V=V+2*S(L)


6   W=W+1:H=S(X+5)+((R+1)*SIN(S(A))):I=S(Y+5)-((R+1)*COS(S(A))):COLOR 2:PLOT H,I:T=1:WHILE T<R:CIRCLE H,I,T: T=T+1:WEND :COLOR 3


7   CIRCLE H,I,R:COLOR 1:S(J)=0:WHILE S(J)<2:S(A+5)=S(A)-45+(90*S(J)):S(L+5)=S(L)*F/100:X=X+5:Y=Y+5:A=A+5:L=L+5:J=J+5


8     D=D-1:GOSUB 5:D=D+1:X=X-5:Y=Y-5:A=A-5:L=L-5:J=J-5:S(J)=S(J)+1:WEND :ENDIF :RETURN


9 ? "Scanning";:Q=0:FOR I=0 TO 76:IF I MOD 8=0:? ".";:ENDIF :FOR H=81 TO 140:LOCATE H,I,P:IF P=3:Q=Q+2:ENDIF :NEXT H:NEXT I:POKE 657,2:RETURN

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Apple Max

Basic 10-Liner for the NOMAM 2015 Competition

by Cliff Hatch

 

The Game

In this game you play the part of a genetic engineer, designing the genome for a new variety of Atarian apple tree.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure 1 Atarian Apple Tree with Circular Variegated Leaves

 

 

The aim is to create a tree that produces the maximum possible number of apples by setting three genes: D, F and R.

  • D controls branching and the number of leaves.

  • F controls the length of successive branches.

  • R controls the size of the leaves.

The genes are coded as integers. Details are given in Table 1.

The best way to start the game is to set the genes randomly for a few turns and observe their effects.

When you enter the numbers and press return, the tree grows, and your Atari computer scans it to measure three parameters:

  • sunin – the amount sunlight energy absorbed by the tree, determined by the visible leaf area (excluding any area shaded beneath overlapping leaves).

  • leafg – the amount of energy required to grow the leaves.

  • brang – the amount of energy required to grow the branches.

These parameters are used to calculate how many apples the tree is capable of producing in a season, and this constitutes your game score. The calculation is:

  • score in apples = sunin - leafg - brang

Some of the energy from the incoming sunlight is consumed in the growth of leaves and branches, and the remainder is used to produce apples.

If your score is negative, this means that the tree cannot absorb enough energy to support itself, let alone grow any apples, and it will die.

Good trees make economical use of branches to present a large number of evenly spread leaves to the sun, avoiding gaps and overlap as far as possible. They also tend to use fairly small leaves because large ones require a disproportionate amount of energy to grow.

A good tree will produce hundreds of apples. Can you find the maximum?

 

 

 

 

 

 

 

 

Table 1 Effect of the Genes

 

 

 

Gene          Range            Description

 

 

D                  1-8               Controls branching and the number of leaves.

                    Atarian apple trees grow in straight segments, each with a single leaf at

                    the end.

                    Each segment potentially branches into two further segments. D is the

                    number of segments connecting ground level to the outermost leaves, e.g.:

 

 

 

 

 

 

 

D=1

 

 

 

 

 

 

 

 

D=2

 

 

 

 

 

 

 

 

D=3

 

 

 

 

 

 

 

 

 

D=6

 

 

 

 

 

F                  58-68%                         Controls the length of the branches. Each segment is F% the size

                           of the previous one:

 

 

 

 

F=50

 

 

 

 

 

 

 

 

 

F=68

 

 

 

 

 

 

 

 

 

 

 

 

 

 

R                    1-4 pix                           Controls leaf radius in pixel widths, e.g.:

 

 

 

 

 

 

R=1

 

 

 

 

 

 

 

 

R=4

 

 

 

 

 

 


 

This site was designed with the
.com
website builder. Create your website today.
Start Now