Author Topic: Fractals using darwinbots.  (Read 4762 times)

Offline peterb

  • Bot Destroyer
  • ***
  • Posts: 148
    • View Profile
Fractals using darwinbots.
« on: November 10, 2008, 01:30:24 PM »
I was in the midle of some coding, and got a nice sample of DNA in between. Doing fractals trough darwinbots.
I think its a kind of amazing since nature also uses these structures and so darwinbots can generate it too within its language.
I wonder if other evo sims could do it, darwinbots is quite intresting.

I post the code twice since I noted the .repro command has great effect when changed.
And so two different versions of almost the same code are shown here.

A smal step for an amoeba but a huge step for evolution   
Feel free to use the code


[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']'full rotatoin = 1256

Code: [Select]
cond
*.971 6 <
start
.971 inc
1256 6 div .aimdx store
30 .repro store
stop

'first
cond
*.971 1 =
start
1256 4 div
*.971 .tie store
stop

cond
*.nrg 3000 mod 0 =
start
.971 0 store
stop


if we put more energy to the cibling different shapes get generated see :

[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']'full rotatoin = 1256

Code: [Select]
cond
*.971 6 <
start
.971 inc
1256 6 div .aimdx store
70 .repro store
stop

'first
cond
*.971 1 =
start
1256 4 div
*.971 .tie store
stop

cond
*.nrg 3000 mod 0 =
start
.971 0 store
stop

Its all very basicly it cannt eat yet dough it might be verry intresting to others I tought so I posted it.

Oh yeah 2 notes
1) you might pause your environment and go to cycle by cycle to see it grow and repro its shape.

2) And when you use above code its better to see when it is not a vegy type (dont ask me why)
« Last Edit: April 30, 2014, 02:40:46 PM by Botsareus »

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Fractals using darwinbots.
« Reply #1 on: November 10, 2008, 10:47:33 PM »
Wow.
I tried to modify it, but there was something I wasn't sure about:
Code: [Select]
cond
*.971 1 =
start
1256 4 div
*.971 .tie store
stop
why not just write
cond
 *971 1 =
start
 1 .tie store
stop

it'll have the same effect.
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline peterb

  • Bot Destroyer
  • ***
  • Posts: 148
    • View Profile
Fractals using darwinbots.
« Reply #2 on: November 11, 2008, 02:51:11 PM »
Quote from: bacillus
Wow.
I tried to modify it, but there was something I wasn't sure about:
Code: [Select]
cond
*.971 1 =
start
1256 4 div
*.971 .tie store
stop
why not just write
cond
 *971 1 =
start
 1 .tie store
stop

it'll have the same effect.


You're right the code should be improved, and actualy that is what I'm trying to figuring out now.
The birth tie disolve automaticaly while it would be nicer to keep on working with it.

Another note maybe people reading the topic trying it get disapointed is that a fractal.
wherent it those beautifull collor things ??
Take a look here http://www.miqel.com/fractals_math_pattern...e-fractals.html
Basicly its a repeating shape, what the above darwin code tries look much like the honeycomb fractal on that site.
Think of it as each cell/bot as a branch dividing to x new branches, while each sub also does this, that explains the shape.

In fact seeing it in Darwin Bots much closer describes some of these fractals as they compare to nature.
Fractals or "the golden ratio" are solutions of close packaging problems.
I once had a dutch computer drawing architect teacher how got a DR degree by making clear that the golden ratio isnt some magical number.
But is related to construction physics, and close packaging. And those rules he explained govern the distribution for example of solar flower seeds (in the flower). And many other natural structures. In his time he was at the frontline with his research and publication, working together with a bioligy DR in Germany. (even got on a TV documentary). Well he got his degree and he had used autocad in combination with math to explain it, all.
(so that part was quite complex).

And so I think its nice to see that also a system like Darwin Bots logic shows us fractals.
This means that ordening might be how to say..
Does verry easily develop using verry simple logic, and simple rules.
Rules with an origin in genetics !.

Hmm if I only could remind his name, I could show it to him, I'm sure he would be excited about it.
« Last Edit: November 11, 2008, 02:52:51 PM by peterb »

Offline peterb

  • Bot Destroyer
  • ***
  • Posts: 148
    • View Profile
Fractals using darwinbots.
« Reply #3 on: November 11, 2008, 03:11:56 PM »
oh ehm and about the code, well I was in the middle of another idea so it wasnt optimal,
In fact I had not fractals in mind (I tried to create a circle, a wheel like multibot )
But when it became fractals, I saw this was a nice error;
As I didnt want to loose the code I posted it as it was at that moment (with some errors).
I had tought of puting tie numbers to adress ciblings  for later multibott communication.

I still have the disapiring birth tie problem, I want to keep it but how to tackle that problem?.  

Offline peterb

  • Bot Destroyer
  • ***
  • Posts: 148
    • View Profile
Fractals using darwinbots.
« Reply #4 on: November 11, 2008, 07:59:22 PM »
Okay, the .tie problem was a bit hard to crack; one needs to replace the "born .tie" with a new one.
But while recreating the new .tie you have to shoot the tie exactly to your parent.
Wel at last I solved it here is sample code, feel free to use it.
Note you can use the txt attachment but dont run it as as a veggy it should be an animal  
Oh and it doesnt eat or reproduce, not implemented that. this is just a code demonstration

maybe someone can explain why it doesnt work that good as a veggy ?
 as it would be so nice for plants, their physics must be different (but what?)


[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']'A simple Fractal (repeating patern)
'like a tree who splits its branches
'By PeterB

'For some unknown reason dont make it a vegetable
'That doesnt endup with a nice shape, I dont know why that is.
'So it has to be like animal.. perhaps a sea sponge
'Dough I have not yet implemented feeding, or further reproducing.
'It is mainly to show the code used so others can use it too.  

'I want to make a note.
'That its intresting to see that DNA meets fractals trough the logic of DarwinBots
'As we now fractals also shapes lots of what we see in nature.
'See how little rules are required in genetic code
'Maybe someone can make an advantage out of it as nature does it.
'
'
'--------------------------
'most important part :
'(note rotation and the <10 have impacts on shape)
'
cond
*971 10 <
*.robage  5 >
start
971 inc
20 .repro store
1256 20 div .aimdx store
stop
'
'--------------------------
'The parts below mainly deal with getting some distance from its parent. (impacts shape)
'Create a new .tie who will persist over time
'And after the tye has been created it rotates. (impacts shape)
'I could have scripted it in less genes but that makes it harder to understand.
'
'
cond
*.robage = 0
start
*.tiepres .deltie store
stop
'
'
cond
*.robage = 1
start
'*.tiepres .deltie store
 *.nrg 5 mult 8 add .dn store
stop
'
'
cond
*.robage = 4
start
.tie inc
stop
'
'
cond
*.robage = 5
start
1256 3 div .aimdx store
stop
'
'
' its better to fix its pos for a second or it may move to much
' it is not realy required to use this
cond
*.robage 15 =
start
.fixpos inc
stop
'
cond
*.robage 15 =
start
.fixpos dec
stop

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Fractals using darwinbots.
« Reply #5 on: November 12, 2008, 04:14:16 PM »
The simplest solution would be to set maximum veggies to 2000 or something like that.
the two last fixpos genes cancel each other out. move the second to *.robage 16 = to stop this.
Plus, you're still operating on the values before they're on the stack eg. *.robage = 4 should be *.robage 4 =
Looks impressive, but functionally, I think version 1 was better (the motion kept snapping the ties).
How about a tree-like structure that grows straight for n iterations, then branches off?
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline peterb

  • Bot Destroyer
  • ***
  • Posts: 148
    • View Profile
Fractals using darwinbots.
« Reply #6 on: November 13, 2008, 10:45:43 AM »
Quote from: bacillus
The simplest solution would be to set maximum veggies to 2000 or something like that.
the two last fixpos genes cancel each other out. move the second to *.robage 16 = to stop this.
Plus, you're still operating on the values before they're on the stack eg. *.robage = 4 should be *.robage 4 =
Looks impressive, but functionally, I think version 1 was better (the motion kept snapping the ties).
How about a tree-like structure that grows straight for n iterations, then branches off?


your right it should have been
*.robage 4 =
I think still mostly in normal math.

The last 2 genes seam to cancel each out. But in fact they dont do in my enviroment, as I use an environment with no friction
In such environment it function likes a car's brake. In the end I dont wanted it to be completly pinned down at its location. so I put my feet of the break.


The tree questoin, well one could do intresting things.
Thats was also why I used memory location *971  (its in a memory area that gets copied to ciblings upon creation).
An extra gene,  might for example be (not tested yet just typing it now)

Code: [Select]
cond
*971 4 =           ' not required just a limitation, so not all branches will grow new seeds
                        ' perhaps different branches have different taks
                        ' others eat / posion /fire energy  or ... something else
*.nrg 3000 >
*.numties 1 =       'to only adress end branches
start
99 .repro
stop

if you want to let the seeds flow in the water / or wind for a while before growing maybe add some extra code
A problem might be that I can potentialy grow quite fast...
For fun I yesterday I had added my 1 gene bot as a gene (not optimal, since it attacked itself too)
But with that gene it could eat (retrieve enrgy ans so it could replicate
But the resulting sim got overwhelmed and took lots of CP power.


Oh and a nother note the last plant I added also randomly rotated itself as Darwinbot randomly rotates new bots. (upside down trees /weeds)
It might be nice for plant (dough not required) to have them grow only upwards. It depends I gues how one sees the environment itself.

Maybe you have an idea why it doesnt work that wel as a veggy ?
« Last Edit: December 22, 2011, 11:57:44 AM by Shasta »

Offline d-EVO

  • Bot Destroyer
  • ***
  • Posts: 125
    • View Profile
Fractals using darwinbots.
« Reply #7 on: November 26, 2008, 11:56:37 AM »
My avitar is an image of a bot I made that uses fractals.
It was also meant to asume a 10 sided shape but my hopes were to high so I made it a 6 sided 0ne.
Here is the bot. made one that moves in unison to but cant find it. only works some of the time

Code: [Select]
'Ameoba

*.construction

cond
 *.numties 0 =
 *.robage 7 <
start
 0 .timer store
stop

cond
 *.robage 0 =
 *.timer 5 <
start
 83 *.timer 1 add 3 mult sub .repro store
stop

cond
 *.robage 0 =
 *.timer 6 <
start
  425 .aimsx store
stop

cond
 *.robage 1 =
 *.timer 7 <
start
  1 .tie store
stop

cond
 *.multi 1 =
start
 1 .tienum store
 20 .stifftie store
 100 .fixlen store
 50 .sharenrg store
 -836 .tieang store
stop

cond
 *.eye5 0 =
 *.myeye *.refeye = or
 *.multi 1 =
start
 *.veldx 10 <
 5 .dx store
 dropbool
 1 .up store
 *.timer 1256 mod %=
 30 up store
 dropbool
stop
 
end

« Last Edit: November 26, 2008, 04:07:06 PM by d-EVO »
1:      2 is true
2:      1 is false

Offline peterb

  • Bot Destroyer
  • ***
  • Posts: 148
    • View Profile
Fractals using darwinbots.
« Reply #8 on: November 26, 2008, 01:31:23 PM »
Maybe such a spiralic fractalic shape shouldnt move but only rotate.

Dough it think that if they all would move forward in their eye direction it would also move.
Since the shape isnt a miror shape in which forces would cancel eachother out.
I'm not that good in ties, but if you know how to harden them, hard them and then then start spinning around.

I'm not sure what is the first or last bot, if the last one is the biggest, maybe let all who have onlx X connection (= outerwall) shoot around.
The structure as a whole would absorb the energy and using tie feeding you might be able to (if there is enough) to release the bigest particle and start all over.
It would be a benefit to be a multibot, shaped like this, as all outerwall bots protect the inner bots...

Well maybe this is al a bit complex dough..

Offline d-EVO

  • Bot Destroyer
  • ***
  • Posts: 125
    • View Profile
Fractals using darwinbots.
« Reply #9 on: November 26, 2008, 04:11:27 PM »
Quote from: peterb
I'm not sure what is the first or last bot, if the last one is the biggest, maybe let all who have onlx X connection (= outerwall) shoot around.
The structure as a whole would absorb the energy and using tie feeding you might be able to (if there is enough) to release the bigest particle and start all over.
It would be a benefit to be a multibot, shaped like this, as all outerwall bots protect the inner bots...

Well maybe this is al a bit complex dough..

sorry, accidental double post
had a bit of browser trouble. fixed now

This is the small one. think I just saved the pic and edited the bot.
Dont think it would be very finctional in that shape even if you could controll all the movements
1:      2 is true
2:      1 is false

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Fractals using darwinbots.
« Reply #10 on: November 26, 2008, 05:21:21 PM »
The 'outer protecting inner cells' principle is frustratingly hard to apply. The only way would be for the cells to sit side-by-side eg. touching each other eg. huge, and that's still leaving the issue of bots penetrating through the cells themselves (plus coordination problems).
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline d-EVO

  • Bot Destroyer
  • ***
  • Posts: 125
    • View Profile
Fractals using darwinbots.
« Reply #11 on: November 26, 2008, 05:59:07 PM »
maby it can rotate in a clockwise direction and any vegies will be pulled into the middle.
wont be very efficient but cool to watch
1:      2 is true
2:      1 is false