Author Topic: A lazy turner(turning gene)  (Read 5749 times)

Offline Welwordion

  • Bot Destroyer
  • ***
  • Posts: 325
    • View Profile
A lazy turner(turning gene)
« on: May 02, 2006, 05:31:45 PM »
Ok I wanted to create a gene that lets a twobot Mb turn 180 degree when he sees his partner. But strangely he does so only once after birth.

Code: [Select]
cond
*.numties 0 =
*.robage 1 >
start
5 .repro store
.function inc
stop

cond
*.robage 1 =
*.refeye *.myeye =
start
.tie inc
stop

cond
*.eye5 0 >
*.refxpos *.trefxpos =
*.refypos *.trefypos =
start
618 .aimdx store
stop

end

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
A lazy turner(turning gene)
« Reply #1 on: May 02, 2006, 07:18:12 PM »
I think it has to do with the tienum resetting (tienum let's you designate which tie to use).

Which version are you running?  Try running the bot in the latest 2.4 and see if it works.  I think Eric fixed it so tienum doesn't reset anymore.

Offline Welwordion

  • Bot Destroyer
  • ***
  • Posts: 325
    • View Profile
A lazy turner(turning gene)
« Reply #2 on: May 03, 2006, 01:31:47 AM »
I am running the latest version.

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
A lazy turner(turning gene)
« Reply #3 on: May 03, 2006, 01:55:56 AM »
Try adding something like:

cond
*.tienum 1 !=
start
1 .tienum store
stop

to your bot and tell me if that fixes it.

Offline Welwordion

  • Bot Destroyer
  • ***
  • Posts: 325
    • View Profile
A lazy turner(turning gene)
« Reply #4 on: May 03, 2006, 11:07:45 AM »
nope no effect

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
A lazy turner(turning gene)
« Reply #5 on: May 03, 2006, 11:16:20 AM »
Dunno then.

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
A lazy turner(turning gene)
« Reply #6 on: May 03, 2006, 12:51:21 PM »
It seems to do what I expect it to do.  It reproduces on cycle 2 then turns away from it's offspring.  The offspring creates a tie to it's parent on it's cycle 1 then turns away so they are back to back.  None of the genes in either bot fire after that for obvious reasons.

What are you expecting it to do?

Note that the reason the parent turns away is different from the reason the offspring turns away.  

The parent turns away because both .trefxpos and .refxpos are 0 (as are .trefypos and .refypos).  Why are they both zero?   Well, both trefxpos and refxpos come from the tied or viewed bot's own xpos.  Since the offspring has a higher bot number than the parent, it has yet to execute a single cycle when the birth tie is formed or when the parent first sees it.  Thus, it's xpos has yet to be populated and thus when the trefvars are copied for the bith tie or when the refvars are copied when the parent first sees the offspring, the parent's refxpos and trefxpos get 0 because the offsping's xpos is still 0.  

The offsping turns away becuase when it sees the parent and creates the tie to the parent, trefxpos and refxpos get populated with real values, which equal.
« Last Edit: May 03, 2006, 01:41:02 PM by EricL »
Many beers....

Offline Welwordion

  • Bot Destroyer
  • ***
  • Posts: 325
    • View Profile
A lazy turner(turning gene)
« Reply #7 on: May 03, 2006, 01:41:35 PM »
Well in my situation they tend to rotate(with the tie) around each other while their eyes stay in the same direction, so when they made a 180 degree rotation their eyes face each other, in this case they should see each other and turn away, but they do not.( oh and could someone answer my birthtie topic in bugs and fixes?)

Simplified they should turn away every time they see each other.
« Last Edit: May 03, 2006, 01:42:14 PM by Welwordion »

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
A lazy turner(turning gene)
« Reply #8 on: May 03, 2006, 01:55:15 PM »
Quote from: Welwordion
Simplified they should turn away every time they see each other.
Ah.  It's a bug.  The trefvars only last a cycle.  I made them sticky in the Tie routines, but they are being erased each cycle in EraseSenses() in another part of the code.  Nice find.   On the list for the next release.

Note that only the offspring will turn away.  The parent will not since the trefvars are only autopopulated for the bot which initiated the tie.
« Last Edit: May 03, 2006, 01:55:59 PM by EricL »
Many beers....

Offline Henk

  • Bot Destroyer
  • ***
  • Posts: 110
    • View Profile
A lazy turner(turning gene)
« Reply #9 on: May 03, 2006, 04:55:57 PM »
I thought .readtie was required to use the tref commands?
cond
*.DBbugs 0 =
start
.rejoice inc
stop

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
A lazy turner(turning gene)
« Reply #10 on: May 03, 2006, 06:23:47 PM »
Quote from: Henk
I thought .readtie was required to use the tref commands?
The autopopulate beginning in 2.42.3.  See #10 here.
Many beers....

Offline Henk

  • Bot Destroyer
  • ***
  • Posts: 110
    • View Profile
A lazy turner(turning gene)
« Reply #11 on: May 04, 2006, 02:52:24 AM »
Ah ok, thanks
cond
*.DBbugs 0 =
start
.rejoice inc
stop

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
A lazy turner(turning gene)
« Reply #12 on: May 04, 2006, 11:50:18 AM »
Quote from: Welwordion
Well in my situation they tend to rotate(with the tie) around each other while their eyes stay in the same direction, so when they made a 180 degree rotation their eyes face each other, in this case they should see each other and turn away, but they do not.( oh and could someone answer my birthtie topic in bugs and fixes?)

Simplified they should turn away every time they see each other.
The reason for this is that once the tie has stiffened, you cannot rotate relative to it by using normal rotation commands

You gotta set .tieang or tiang1 if you want the robots to face away from each other. You can't rely on any rotations prior to the tie hardening, to set the angle correctly. Use something like..

Code: [Select]
cond
*.multi 1 =
start
628 .tieang1 store
stop

That will set the angle from the eye to the tie at exactly half a circle as soon as the bot becomes a part of an MB (ie. when the tie hardens after 20 cycles)
You can even add a tag of some sort so that the gene doesn't get activated on every cycle.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Welwordion

  • Bot Destroyer
  • ***
  • Posts: 325
    • View Profile
A lazy turner(turning gene)
« Reply #13 on: May 08, 2006, 01:17:41 PM »
hmm does not work, they do not turn away from each other and I found out they keep rotating and rotating on and on,so this effect is not by intiasl inertia.

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
A lazy turner(turning gene)
« Reply #14 on: May 08, 2006, 01:24:42 PM »
Quote from: Welwordion
hmm does not work, they do not turn away from each other and I found out they keep rotating and rotating on and on,so this effect is not by intiasl inertia.
Ties don't stiffen and lock their angles (as they should) in the 2.4 fork prior to the as yet unreleased 2.42.4 which is why they keep rotating in the version you are using.

They don't turn away from each other becuase of the trefvar issue above.  

All this will be fixed in 2.42.4 which hopefully I can release later today.
Many beers....