Bots and Simulations > DNA - General

Randomness doesn't work here.

(1/2) > >>

Testlund:
There should only be a 1 chance out of 3 for this bot to start shooting when energy becomes lower than body, but that is completely ignored and the bot will always shoot.


--- 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 ---

Shadowgod2:
You forgot the * on the 50

Shadowgod2:
Oops

In the shoot gene

Testlund:
OK, that improved it a little but the randomness is only generated when the sim starts, after that the shooting bots will ignore the instruction and always shoot.

So with free variables you always type it like this?

cond
 *random 3 =
start
stop

Not like this?

cond
 *.random 3 =
start
stop

Botsareus:
Ok, I see exacty what is going on... sorry for the confusion...

If it is a number it is just "50" if not it is always starts with a period as in:


--- Quote ---def pizza 50
.pizza or *.pizza

--- End quote ---

Navigation

[0] Message Index

[#] Next page

Go to full version