Code center > Bugs and fixes

Stores not executed in 'else' blocks

(1/2) > >>

Sprotiel:
For my demonstration, I used an Animal_Minimalis slightly modified to have a search pattern in wide irregular circles.

If for the first gene, I use

--- Code: ---cond
0 1 =
start
10 .up store
else
10 .up store
stop
--- End code ---
bots stay put while turning when they see nothing instead of describing wide circles. However, the code should be correct because replacing the condition with '0 0 =' yields expected behaviour.

To get the else block to execute properly, I need to write:

--- Code: ---cond
0 1 =
start
10 .up
else
10 .up
stop

cond
start
store
--- End code ---

Obviously, the problem comes from store instructions not being executed inside the 'else'-block.

Solution: in Private Sub ExecuteDNA(n As Integer), replace the second line of

--- Code: ---      Case 7 'store, inc and dec
        If CurrentFlow = body Then
--- End code ---
by
--- Code: ---If CurrentFlow = body Or CurrentFlow = ELSEBODY Then
--- End code ---

Numsgil:
That's a pretty fundamental error, I'm suprised it hasn't been caught until now.

EricL:
I guess very few people use else conditions...

Fixed in 2.42.9p.

Numsgil:
like no one

Jez:
Oy! I would if I were writing bots atm, the first time I tried using it in bots it didn't work anyway, but with all the new improvements since I shall astound you all, at some point in the future  , with a new generation of bots that will Else the rest of the bots into wishing they didn't exist!  

Navigation

[0] Message Index

[#] Next page

Go to full version