Bots and Simulations > DNA - General

Randomly choosing a sysvar

(1/1)

Shasta:
In response to a discussion page on the wiki (don't use those, really, the forum is much more likely to get a response) I made this snippet:

--- Code: ---def aimrx 971
start
    *.aimrx 0 =
        1 rnd 0 = overbool overbool and
            .aimsx .aimrx store
        dropbool not and
            .aimdx .aimrx store
    dropbool
    true
    10 *.aimrx store
stop

--- End code ---

This will randomly chose between turning left and right and then makes it easy to use the choice anywhere with the "new sysvar" of aimrx. 971 is a Racial Memory location, so the value will persist across generations. If you don't want that just change the def.

Navigation

[0] Message Index

Go to full version