Bots and Simulations > DNA - General
Randomness doesn't work here.
Testlund:
OK. Well, the randomness is only run when the sim starts. After that the bots will be stuck with there choices. I was thinking there should be a way to re-run whenever the bots get "hungry".
Botsareus:
--- Code: ---'If 50 is not 3; shoot!
cond
*.nrg *.body <
50 * 3 !=
start
-6 .shoot store
stop
'Reset 50 to 0 when .nrg becomes more than .body.
cond
*.nrg *.body >
start
0 50 store
100 .strbody store
stop
'Set 50 to a random number between 1 and 3 when .nrg and .body are equal.
cond
*.nrg *.body =
start
3 rnd 50 store
stop
--- End code ---
or
--- Quote ---'If 50 is not 3; shoot!
cond
*.nrg *.body <
*50 3 !=
start
-6 .shoot store
stop
'Reset 50 to 0 when .nrg becomes more than .body.
cond
*.nrg *.body >
start
0 50 store
100 .strbody store
stop
'Set 50 to a random number between 1 and 3 when .nrg and .body are equal.
cond
*.nrg *.body =
start
3 rnd 50 store
stop
--- End quote ---
The confusion is between a physical address or a defined operator, they both mean the same thing.
.nrg is comrehanded by the compiler as some orbitrary number as well as the number itself say 50.
Shadowgod2:
Well the way you say it you want a 1/3 chance but you post 2/3 chance
Try 3 50 store as your reset (2/3)
Try *50 3 = as time to shoot (1/3)
Testlund:
Yeah, I thought backwards there. :P I get a little better result now, at least when the sim starts.
Navigation
[0] Message Index
[*] Previous page
Go to full version