Darwinbots Forum
Code center => Bugs and fixes => Topic started by: Numsgil on April 16, 2006, 12:30:40 PM
-
THis is in the DNAExecution module:
Private Sub ExecuteStores(n As Integer)
Select Case n
Case 1 'store
DNAstore
rob(currbot).nrg = rob(currbot).nrg - SimOpts.Costs(COSTSTORE)
Case 2 'inc
DNAinc
rob(currbot).nrg = rob(currbot).nrg - SimOpts.Costs(COSTSTORE) / 10
Case 3 'dec
DNAdec
rob(currbot).nrg = rob(currbot).nrg - SimOpts.Costs(COSTSTORE) / 10
Case 4 '+=
Case 5 '-=
Case 6 '*=
Case 7 '/=
End Select
End Sub
Private Sub DNAstore()
Dim b As Long
b = PopIntStack
If b > 0 And b <= MaxMem Then
rob(currbot).mem(b) = PopIntStack Mod 32000
End If
End Sub
Private Sub DNAinc()
Dim a As Long, b As Long
a = PopIntStack
If a >= 1 And a <= 1000 Then
b = (rob(currbot).mem(a) + 1) Mod 32000
rob(currbot).mem(a) = b
End If
End Sub
Private Sub DNAdec()
Dim a As Long, b As Long
a = PopIntStack
If a >= 1 And a <= 1000 Then
b = (rob(currbot).mem(a) - 1) Mod 32000
rob(currbot).mem(a) = b
End If
End Sub
change this to:
Private Sub ExecuteStores(n As Integer)
Select Case n
Case 1 'store
DNAstore
Case 2 'inc
DNAinc
Case 3 'dec
DNAdec
Case 4 '+=
Case 5 '-=
Case 6 '*=
Case 7 '/=
End Select
End Sub
Private Sub DNAstore()
Dim b As Long
b = PopIntStack
If b > 0 And b <= MaxMem Then
rob(currbot).mem(b) = PopIntStack Mod 32000
rob(currbot).nrg = rob(currbot).nrg - SimOpts.Costs(COSTSTORE)
End If
End Sub
Private Sub DNAinc()
Dim a As Long, b As Long
a = PopIntStack
If a >= 1 And a <= 1000 Then
b = (rob(currbot).mem(a) + 1) Mod 32000
rob(currbot).mem(a) = b
rob(currbot).nrg = rob(currbot).nrg - SimOpts.Costs(COSTSTORE) / 10
End If
End Sub
Private Sub DNAdec()
Dim a As Long, b As Long
a = PopIntStack
If a >= 1 And a <= 1000 Then
b = (rob(currbot).mem(a) - 1) Mod 32000
rob(currbot).mem(a) = b
rob(currbot).nrg = rob(currbot).nrg - SimOpts.Costs(COSTSTORE) / 10
End If
End Sub
BTW, does anyone know if there's a way I could just post code and highlight changes in like red? THe color tags won't work if I have the code tags on.
-
This change will be in 2.42.3. Stores to locations outside valid memory will cease to cost anything.
-
Yey Now my conditionless bots will work efficiently again
-
BTW, does anyone know if there's a way I could just post code and highlight changes in like red? THe color tags won't work if I have the code tags on.
Not without modding the php code somewhat.
try putting the code in quote tags. They look pretty similar these days and color tags work in them
-
Ah, quotes, there's an idea.