Author Topic: Fixing Stores in 2.4  (Read 5016 times)

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Fixing Stores in 2.4
« on: April 16, 2006, 12:30:40 PM »
THis is in the DNAExecution module:

Code: [Select]
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:
 
 
Code: [Select]
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.
« Last Edit: April 16, 2006, 12:40:51 PM by Numsgil »

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Fixing Stores in 2.4
« Reply #1 on: April 16, 2006, 12:44:43 PM »
This change will be in 2.42.3.  Stores to locations outside valid memory will cease to cost anything.
Many beers....

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
Fixing Stores in 2.4
« Reply #2 on: April 16, 2006, 01:00:55 PM »
Yey   Now my conditionless bots will work efficiently again

 
« Last Edit: April 16, 2006, 01:01:49 PM by Elite »

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Fixing Stores in 2.4
« Reply #3 on: April 17, 2006, 09:12:05 AM »
Quote
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  
« Last Edit: April 17, 2006, 09:13:20 AM by PurpleYouko »
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Fixing Stores in 2.4
« Reply #4 on: April 17, 2006, 01:13:09 PM »
Ah, quotes, there's an idea.