Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
In this simulation, "lightning" (moving green dot, this is WIP, it will be a set of lines in later versions) is evolving to strike your "house". (i.e. the blue dot)
There are obstacles that the lightning has to pass (blue lines)

This is greatly inspired by this simulation: yt link

After each simulation, numbers will be shown on your screen:

The list tells you which creature did the best, with the first creature displayed being 1, the second being 2, etc.
The 3 numbers on the bottom show you the highest fitness (did the worst), the average fitness, and the lowest fitness (did the best).

The fitness is the distance from your house to where the lightning strike ended.

Here's the code (sorry for weird post, this is WIP and I don't really have much to say. I'll update this when I get the graphics done.)

Code:
Degree
GridOff
AxesOff
ClrDraw
{100,88,20,2}->L3
ZStandard
ZSquare
Pxl-On(L3(2),L3(1)
Line(~16,2,~1,2
Line(1,2,16,2
Line(~1,10,~1,0
40->N
N->dim(L4
N->dim(L5
N->dim(L6
20N->dim(|LD
20N->dim(|Ltheta
DelVar D
For(A,1,N
   180->R
   For(B,1,20
      D+1->D
      randInt(~45,45)->C
      If (R+C)<0
      min(max(R+C,~90),90->R
      If (R+C)>=0
      min(max(R+C,90),270->R
      R->L1(D
      randInt(1,8)->L2(D
   End
End
Repeat 0
   DelVar D
   For(A,1,N
      1->Z
      132->I
      24->J
      For(B,1,20
         D+1->D
         sin(L1(D->K
         ~cos(L1(D->L
         For(C,1,L2(D
            If Z
            Then
               I+K->I
               J+L->J
               If pxl-Test(int(J),int(I
               DelVar Z
               For(theta,0,1
                  If Z:Then
                     Pxl-Change(int(J),int(I),Green
                     Wait 0.001
                  End
               End
            End
         End
      End
      sqrt((L3(1)-I)^^2+(L3(2)-J)^^2)->L4(A
      Ans->L5(A
   End
   
   SortA(L4
   DelVar I
   For(A,1,N
      0->B
      Repeat Ans
         B+1->B
         L4(A)=L5(B)
      End
      B->L6(A
      For(D,1,20
         I+1->I
         L1(20(B-1)+D->|LT1(I
         L2(20(B-1)+D->|LT2(I
      End
   End
   |LT1->L1
   |LT2->L2
   Disp L6
   round(L5,2
   Disp toString(max(Ans))+":"+toString(mean(Ans))+":"+toString(min(Ans
   int(N/2)->dim(L6
   DelVar E
   For(A,1,N/2
      20(A-1)->D
      For(B,1,20
         D+1->D
         E+1->E
         L1(D)->R
         Ans->|Ltheta(E
         DelVar C
         If not(randInt(0,L3(4))
         (randInt(~45,45)*not(randInt(0,L3(3)))+randInt(~10,10)->C
         If (R+C)<0
         min(max(R+C,~90),90->R
         If (R+C)>=0
         min(max(R+C,90),270->R
         R->|Ltheta(E+20*(N/2))
         L2(D)->|LD(E
         min(max(L2(D)+(not(randInt(1,L3(4))*randInt(~1,1))),1),8->|LD(E+20*(N/2)
      End
   End
   |Ltheta->L1
   |LD->L2
End


I can't really post a screenie, as I'm in a rush.
/me thinks somebody likes evolution simulators
CalcMeister wrote:
/me thinks somebody likes evolution simulators


More machine learning in general.

I came across a much better way to do this, so revisions will happen.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement