Darwinbots Forum
Code center => Bugs and fixes => Topic started by: Sprotiel on December 17, 2006, 01:54:39 AM
-
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
cond
0 1 =
start
10 .up store
else
10 .up store
stop
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:
cond
0 1 =
start
10 .up
else
10 .up
stop
cond
start
store
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
Case 7 'store, inc and dec
If CurrentFlow = body Then
by If CurrentFlow = body Or CurrentFlow = ELSEBODY Then
-
That's a pretty fundamental error, I'm suprised it hasn't been caught until now.
-
I guess very few people use else conditions...
Fixed in 2.42.9p.
-
like no one
-
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!
-
Else will particularly be useful when codules get implemented. It will basically allow some rather complex decision forking. I'm working on a bot prototype that would use codules to see how coding with codules will work.
-
Bah! Let the program design the bots I say!