Bots and Simulations > DNA Tools
Sanger
Numsgil:
Does it allow nested conditions? Animal Minimalis's second gene is collapsable in to the first if you nest it. I tried doing it myself, and it didn't yell at me and seemed to compile, but I'm too lazy to double check it to see if it did it right.
Numsgil:
Also, you don't need to start the DNA with a cond. You can just have a start statement, because an empty bool stack is assumed to be true, so a start statement will run without a cond. Second, you don't need a stop statement. Once the end of the DNA is reached, a stop and end command are assumed.
Also, it would be nice if the compiled DNA result was formatted a little better. It gave me this for my Animal Minimals tweak:
--- Code: ---cond
start
*.eye5 0 > *.refeye *.myeye != and *.refveldx .dx store
*.refvelup 30 add .up store
*.eye5 50 > -1 .shoot store
*.refvelup .up store true or and true or and
*.eye5 0 = *.refeye *.myeye = or 314 rnd .aimdx store true or and
*.nrg 20000 > 10 .repro store true or and
stop
--- End code ---
Where something like this would look better:
--- Code: ---start
*.eye5 0 >
*.refeye *.myeye != and
*.refveldx .dx store
*.refvelup 30 add .up store
*.eye5 50 >
-1 .shoot store
*.refvelup .up store
true or and true or and
*.eye5 0 =
*.refeye *.myeye = or
314 rnd .aimdx store
true or and
*.nrg 20000 >
10 .repro store
--- End code ---
Gobo:
Yes, surely it's collapsable. You can do arbitrary deep nested ifs. I just wanted to save the whole logic of Animal Minimalis to have a better analogy.
--- Code: ---friendly() -> *.refeye == *.myeye;
always {
/* Food Finder + Eat Food + Avoiding Family */
if ( *.eye5 > 0 && !friendly() ) {
.dx = *.refveldx;
if ( *.eye5 > 50 ) {
.shoot = -1;
.up = *.refvelup;
}
else {
.up = *.refvelup + 30;
}
}
else .aimdx = rnd(314);
/* Reproduce */
if ( *.nrg > 20000 ) .repro = 10;
}
--- End code ---
Formatting is in the queue. It's not of the first priority, I hope you agree.
Perhaps I will remove cond from definition of always gene. But stop is better to stay, imho, because there may be more than one gene, and it's not a great deal to save a single command in the special case of the last gene.
Numsgil:
--- Quote from: Gobo ---Yes, surely it's collapsable. You can do arbitrary deep nested ifs.
--- End quote ---
Will it handle changes to the condition or integer stack? That is, if I do:
--- Code: ---if (false) {
10
} else {
20 store
}
--- End code ---
Will it store 10 to 20 or not? It's not supposed to, though this is a rather pathological example.
--- Quote ---Perhaps I will remove cond from definition of always gene. But stop is better to stay, imho, because there may be more than one gene, and it's not a great deal to save a single command in the special case of the last gene.
--- End quote ---
True.
Gobo:
You cannot operate stacks directly with Sanger 2.0 (at least, at the moment). You must store a value into the memory. Otherwise there would be much confusion, because the integer stack is used for expressions evaluation.
Though 'if (false)' shall work right (it doesn't, because I forgot to define true and false )
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version