Bots and Simulations > DNA - General

turning

(1/2) > >>

Griz:
just beginning to explore bots now ...
and wanted to start with a fairly simple one that works well
and one that I have used a lot and am familiar with as far as knowing how
it reacts and works in the sims I have set up.

have been using C_Circumgirans a lot with Boris' MultiVeg as it drags it around
when it isn't fixed and stretches it out to make an interesting sim to watch.
the entire field ends up with a counter-clockwise rotation which is quite mesmerizing.
so I thought it would be interesting to have the same bot ...
only have it rotate clockwise instead of CCW ....
and that would be a good way to begin to understand bot motion.

here's the code for C_Circumgirans ... ccw version.

now I have no idea how any of this works ...
it's all brand new to me and even after reading the bot tutorial on the wiki ...
I still have to do some hands-on stuff ... change things and see what happens
before it begins to make any sense to me. ... tweak this or that and 'see' what happens or doesn't happen ... f anything.
so that's what I am doing here.

I played with the first and second genes here ....
altering the 17 and 16 to -17 and -16.
that does seem to give them the CW motion but there must be more to it ...
as they don't seem to detect one another and follow, or detect and shoot.

so what am I missing here?
what else needs to be changed to make it a 'mirror image' of the CCW version?

could someone go thur this bot gene by gene and explain what each is doing and how?
either here or on the wiki?  it's easier to comment on the code there but whatever.
that would be a great help.
thanks




--- Code: ---' C_Circumgirans
 
cond
  *.eye6
  0
  !=
start
  21
  40
  store
  17            'altered this to -17 for CW revolution
  .aimdx
  store
stop

cond
start
  16             'altered this to -16 for CW rev
  .aimsx
  store
stop

cond
  *.eye8
 -1
  !=
start
 -4        'changing the sign here
  .dn
  store
  4        ' and here only resulted in the bot moving 'backwards'
  .up
  store
stop

cond
  *.aimdx
  0
  >
start
 -1
  .shoot
  store
  6
  .nrg
  store
stop

cond
  *.refsx        'this has to do with relative motion between bots, yes?
  6181
  !%=
  *.nrg
  6181
  >
start
  430             'altered this to -430 but didn't see it changed anything so put it back
  .aimdx
  store
  50
  .repro
  store
  42
  .out1
  store
  37
stop
end
--- End code ---

Griz:
ah ha!
different rotation direction so had to look the other way to shoot.

changed gene 4
 
cond *.aimdx  0 > start -1 .shoot  store 6 .nrg store stop
 
to:

cond *.aimdx 0 < start -1 .shoot store 6 .nrg store stop
 
and now it shoots.
I didn't know if it would accept < 0 ... but it seems to be working.
wouldn't > 628 do the same thing?  just looking to the right instead
of the left as the ccw version does?

Numsgil:
No, because *.aimdx isn't a read back, it's a write to.

By that I mean .aimdx is where you're writing values to use at the end of the DNA, so your conditions should reflect that you're doing negative values.

ie:
-17 .aimdx store

instead of
1239 .aimdx store

or however you'd do it.

1256 is a full circle BTW, I dunno if you knew that or not.

PurpleYouko:
C_Circumgirans has one of the weirdest DNAs of all the robots that we have.

From a logical oint of view it doesn't make much sense and has no flow at all. The DNA is riddled with useless commands.

Here is a breakdown on what the genes do.

Gene 1. This could actually be the source of the CCW movement.

It looks at *.eye6 (one eye to the right of center) and if it sees anything at all, it stores a value of 21 into memory location 40  :blink: before rotating a little bit (17) to the right.

There is no other reference to memory location 40 in the entire genome. It is utterly pointless except to fill up the stack with meaningless crap. (I sometimes wonder if this is an evolved bot)

Gene 2.

No condition here so the bot ALWAYS rotates 16 to the left on every cycle. If gene one has activated then this leaves a net rotation of one point to the right

Gene 3

Looks for a value of NOT -1 in eye8. Since the eyes NEVER return negative values, this gene will ALWAYS activate on every cycle.
All this gene does is to move forward by storing 4 in .up and -4 in .dn. This was actually a free movement bug in V2.11 where the cost of movement was equal to the value in .up added to the value in .dn, so I don't know whether C_Circumgirans was built this way or evolved this behaviour.

Gene 4

Looks for a positive value in .aimdx and if it finds it then it shoots. It also stores 6 into .nrg (which is actually impossible to do)
Since .aimdx is an INPUT rather than a readback, the only way it can contain a value is if the DNA put it there in gene 1.

Gene 5

*.refsx actually reads back the number of .sx commands in the viewed robot's DNA. It has nothing to do with movement.
What this gene does is to look for a number of .sx commands that is NOT almost equal to 6181. Seems a fair assumption that this will ALWAYS return TRUE and is completely useless.
Next it checks if its own energy is greater than 6181 and if it is then it rotates about a third of a turn to the right, reproduces, then stores 42 into .out1. It then goes on to place a value of 37 onto the top of the stack for no good reason.
Gene 5 is a repro gene. Any changes made here will only effect its behaviour during reproduction.


From this DNA, C_Circumgirans should travel in small CCW circles (controlled by gene 2) so long as it doesn't encounter anything. When it does see something a little to the right of centre it will begin to turn very slightly right  (1 point) and shoot constantly.

It accelerates forward constantly and shoots only while turning to the right

Rotation commands can hold any value between -1256 and +1256. A positive .aimsx is exactly the same as a negative .aimdx except that they may exist concurently. If you were to store 200 in .aimsx and 200 in .aimdx the net result would be zero rotation.

Griz:

--- Quote ---C_Circumgirans has one of the weirdest DNAs of all the robots that we have.

From a logical oint of view it doesn't make much sense and has no flow at all. The DNA is riddled with useless commands.
--- End quote ---
LOL ....
so wouldn't you know I'd pick that one to use as a learning device. ;)

btw ... it is an evolved bot ... I find this in the comments:
' Comisia Circumgirans
'
' Robot NanniMorettiano
' (you'd need to know some italian politics
' to understand that... I hope you don't)
' Evolved 2002 from c. ancestralis
'
' A very efficient robot, it has the ability
' to move in swarms (swarms that become
' round when there is no food in sight,
' so the name).

I still like it but it seems to me one could strip a lot of this useless
stuff out and have it do it's thing more effieciently, eh?

what can be eliminated then?

btw ... where do I find what eye looks where?
perhaps this is what I am missing.
is this info available anywhere in a central location ...
if it is in your bot tutorial I haven't found it ...
nor do I find it on the wiki either.

this is what it does:
From this DNA, C_Circumgirans should travel in small CCW circles (controlled by gene 2) so long as it doesn't encounter anything. When it does see something a little to the right of centre it will begin to turn very slightly right  (1 point) and shoot constantly.
 
so:

Gene 1:
drop the store 21, 40 thing, yes?
now if it sees anything,  it 'rotates right 17 ....

modified by
Gene 2:
which always rotates left 16.

Gene 3:
forward movement of 8

Gene 4:
eliminate the store nrg.
this gene shoots if it sees a positive value in .aimdx
with eye 8 ... [where is eye 8 looking?]

Gene 5:
*.refsx actually reads back the number of .sx commands in the viewed robot's DNA. It has nothing to do with movement.
What this gene does is to look for a number of .sx commands that is NOT almost equal to 6181. Seems a fair assumption that this will ALWAYS return TRUE and is completely useless.

so I can eliminate *.refsx  6181 ?

Next it checks if its own energy is greater than 6181 and if it is then it rotates about a third of a turn to the right, reproduces, then stores 42 into .out1. It then goes on to place a value of 37 onto the top of the stack for no good reason.

so eliminate store  37 ?

will give it a shot.
now ....
to make the mirror image ... ie ... rotate Clockwise ...
I alter the sign for the 17 and 16 in gene 1 and 2 ....
and in gene 4, have it fire if it sees a negitive value in .aimdx?
 *.aimdx 0 <
or can it also be done looking for a pos value in .aimsx?
 *.aimsx 0 >

btw ... I did these 3 changes and it does indeed rotate CW and swarm
pretty much like the original but ...
it doesn't react the same way with the veggies ....
and eventually dies out ... it just isn't as hardy as the orig CCW version.
any ideas why????
hmmmmm .... didn't change the sign on the 430 for repro ....
will do that as well ... who knows?

thanks.
and again ...
is there somewhere where the function of 'eyes' is explained in detail ...
the differences between eye 9 and eye 8, etc?
I haven't found it yet ... although I know Endy is slowly adding
various DNA stuff to the wiki.
does the search thing work now here at the DB forum?
it wasn't last time I tried.

ok
on we go

Navigation

[0] Message Index

[#] Next page

Go to full version