Author Topic: inc and dec cost energy  (Read 3208 times)

Offline Sprotiel

  • Bot Destroyer
  • ***
  • Posts: 135
    • View Profile
inc and dec cost energy
« on: May 22, 2005, 07:59:50 PM »
Looking through the code, I was fairly surprised to discover that
Code: [Select]
a incis (almost) exactly equivalent to
Code: [Select]
*a 1 add a storeThis means that contrary to what is stated everywhere I've looked, inc and dec cost exactly as much energy as store.

Offline Light

  • Bot Destroyer
  • ***
  • Posts: 245
    • View Profile
inc and dec cost energy
« Reply #1 on: May 22, 2005, 11:56:16 PM »
They are exactly equivalent and no inc and dec do not cost any energy.

Offline Sprotiel

  • Bot Destroyer
  • ***
  • Posts: 135
    • View Profile
inc and dec cost energy
« Reply #2 on: May 23, 2005, 07:14:34 AM »
Please check by yourself. For instance with a dummy bot like
Code: [Select]
cond
start
50
inc
stop
and a high store cost. Note that there's another quirk: the actual store cost is 1/5th of what is displayed in the Options tab.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
inc and dec cost energy
« Reply #3 on: May 23, 2005, 09:00:54 AM »
inc and dec have always been free but recently there was a lot of discussion about the benefits of making it more equivalent to store.
I didn't even realise that the cost structure had been implemented though.
It must have been one of the many modifications that Numsgil added for V2.36.

Just remember that pretty much all the documantation was produced prior to this version.
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
inc and dec cost energy
« Reply #4 on: May 24, 2005, 02:20:28 AM »
I haven't touched inc or dec, not even when I first started.  If it's costing energy suddenly, it's new to me.   :blink:

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
inc and dec cost energy
« Reply #5 on: May 24, 2005, 09:44:21 AM »
Hmm?

Wonder what it is then?

I know that all commands cost something

That is defined in the options window by "Condition cost". It is set to 0.02 points per DNA instruction by default.

I will look into it today.

Sorry for accusing you Num. Just thought you might have played with costs along with all the stuff that you did for 2.36.
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
inc and dec cost energy
« Reply #6 on: May 24, 2005, 04:25:29 PM »
More than just costing energy, there was something very weird going on.

Basically, dec and inc worked like this:

1.  Read the top value on the stack.  This is the memory location.
2.  Place two values on the stack that correspond to memory location and *memory location +/- 1.
3.  Make a call as if a store command had been used.

I have no idea where this came from.  I fixed it though.