Author Topic: Timerless timer  (Read 4451 times)

Offline Reiyuki

  • Bot Neophyte
  • *
  • Posts: 8
    • View Profile
Timerless timer
« Reply #15 on: April 29, 2008, 04:15:39 PM »
I didn't know .timer wrapped, so that would definitely work.    
*.timer 10 mod 1 =
(runs once every 10 cycles)


Figured I'd add some hacks to this concept too..  

Lets say you want to only run a certain gene 10 cycles out of 100:
*.timer 100 mod 90 >=

will activate when timermod= 90,91,92,93,94,95,96,97,98,99  but no other time.
Would result in a 10% duty cycle with a 100 cycle frequency.


It might be useful for synchronized breeding, virii propagation, flock management, etc.  I know I use it all the time.

Offline Peksa

  • Bot Destroyer
  • ***
  • Posts: 118
    • View Profile
Timerless timer
« Reply #16 on: April 29, 2008, 04:47:00 PM »
Quote from: EricL
ahem

Code: [Select]
5 rnd 1 =
ahem


Haha, agreed.

Offline Moonfisher

  • Bot Overlord
  • ****
  • Posts: 592
    • View Profile
Timerless timer
« Reply #17 on: April 30, 2008, 03:06:55 AM »
Ehm, just so peopel know, triggering a gene every x cycles is not the only use for mod (modulus).
Basicaly when you divide one number by another you always have a remainder (sometimes 0), mod gives you that remainder and disregards the result of the actual division.

So :
20 10 mod : Means divide 20 by 10 and give me the remainder... in this case 0

You can also use that for setting eyefocus and such stuff :

'Cycle between all eyes.
start
*.timer 9 mod 4 sub .focuseye store
stop


The timers also good for several genes that takes more than one cycle to execute :

cond
*.enemysighted 1 =
start
*.timer .timestamp store
stop

cond
*.timestamp 0 add *.timer =
start
'step 1
stop

cond
*.timestamp 1 add *.timer =
start
'step 2
stop

asf...

Anyway moving off topic, point was that mod is just modulus... a very simple math operator. If you can divide you can use mod...

Offline gymsum

  • Bot Destroyer
  • ***
  • Posts: 215
    • View Profile
Timerless timer
« Reply #18 on: April 30, 2008, 05:11:13 PM »
Timers are perfect for fetch and store through veg ties. Every cycle, a bot forces sonme var into another location, then on the next cycle (or every 2 cycles), another bot reads that location and var, and acts acordingly. The trick for syncronization is using the lowest common denominator, so that you don't get an overlap down the line.

Timers aren't the greaetest for focuseye especially if you use the 360 configurations. Timers are better for information transfer among large MB networks, so that a bot doesn;t try telling the same two bots the same thing while the rest go derrrr. Mod is the remainder of a quoteint or product, or in the case of a graph, it is a point with which a conical sphere (or doughnut) is formed around leaving a whole, or in certain aplications, antoher plane for say imaginary numbers. It reset 0 to whatever number you want, perfect for Myan convertions. GOd how I love Mod functions....

For isntance time is a modular function on anolog clocks. 12 mod 24 should always read as 12, and 24 mod 24 should read as 0, so that is to say that all the numbers wrap around the number 24. Modular functions are also perfect for 3d vision systems; I'm working on an MB to use two bot's eyes on one target to acurately pinpoint its location using a mod from the eyef vars of both bots. You use a mod to wrap other numbers around them, meaning *.robage mod 20 will always wrap the robots age around the number 20 (or for those that raelly love math, it replaces the number 0 with 20, now we can go into quantum physics, or stay on point). Modulous is a wonderful thing, in fact, I think I might have figured a method for ceating complex structures in DB using MB.. Bacillius, can I edit your Ant bot? The one where hive id was introduced, I think I can make a unique thing for the Ant dna that wouldn't be to complex or large. I woudl add it to the Slim Evo project, but I'm thinking more along the lines of a multibot that never becomes single bot again, the Ant Bot project would raelly get some use out of it, both in tactics and hive formation.

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Timerless timer
« Reply #19 on: May 14, 2008, 02:33:41 AM »
Sure, knock yourself out.
Just so you know, basing a unique Id mightn't be the best of ideas, chiefly because the first generations will always have the same ID, a big problem for hive Ids.
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan