Darwinbots Forum

Code center => Suggestions => Topic started by: Welwordion on December 04, 2007, 01:51:14 PM

Title: sysvariables to execute thinks for "every" idea
Post by: Welwordion on December 04, 2007, 01:51:14 PM
It would be nice that if I wanted to do the same thing for all 9 eyes if I could write that in one gene instead of nine.  So a gene that executes itself 9 times and changes the numbers in  eyevariables  etc s by inc mod 9 1 add accordingly:

.eye1---> .eye2 .... .eye9---> .eye1  ;    61 store --> 62 store....  69 store --> 61 store
Title: sysvariables to execute thinks for "every" idea
Post by: Numsgil on December 04, 2007, 02:56:25 PM
I'm toying with a foreach operator of some sort for DB3, however the way the language is set up, it's just not all that easy in the current version.  What you really want is a loop, but implementing a raw loop is impossible because bots are designed to implement their entire DNA each cycle.
Title: sysvariables to execute thinks for "every" idea
Post by: Gobo on December 05, 2007, 02:37:59 AM
Well, you can use cycles for imitating the loop.
Code: [Select]
*.value .eye1 *.robage 9 mod add store