Bots and Simulations > DNA - General
Divide by Zero
(1/1)
Shasta:
I was trying to write a new bot and came across a few questions that I couldn't find an answer for.
What value does a divide by zero return? I saw in DB 3 it will yield a 0 is this true for 2.4x also?
True and False can be used to control whether parts of genes execute, can conditional operators be used to control them?
For example I have a gene (Which I doubt works, as this computer cant really run DB I cant test it) that asses if the bot is being hurt to much and should run away:
--- Code: ---'See If I Am Being Hurt Too Badly
cond
*.wellness 0 <=
start
628 rnd 314 add .aimsx store
*.maxvel .up store
*.welltime 4 mod 0 =
0 .wellness store
stop
--- End code ---
Finally,
--- Code: --- *.refnrg *.refkills div *.nrg *.kills div div 1 >= 'Less than one is bad/dangerous
--- End code ---
Would there be a better option for checking if the bot in eye5 is worth attacking? This one would have problems depending on what a divide by zero returns (veggies) and for low energy bots and a couple of other problems, such as never finishing off bots.
Edit: Also how many cycles does poison last for, is it the same as venom?
Sorry for all of the questions
Numsgil:
--- Quote from: Shasta ---What value does a divide by zero return? I saw in DB 3 it will yield a 0 is this true for 2.4x also?
--- End quote ---
It's 0 too. Generally any command that's mathematically invalid will return 0. (like sqrt(-number)).
--- Quote ---True and False can be used to control whether parts of genes execute, can conditional operators be used to control them?
--- End quote ---
Yes. You don't even need to break up your genes into cond and start blocks even.
--- Quote ---Edit: Also how many cycles does poison last for, is it the same as venom?
--- End quote ---
Yep, same as venom. 1 cycle per unit.
--- Quote ---Sorry for all of the questions
--- End quote ---
Not at all.
Navigation
[0] Message Index
Go to full version