Author Topic: Bitwise Functions  (Read 2467 times)

Offline Anonomous Guest Person

  • Bot Builder
  • **
  • Posts: 85
    • View Profile
Bitwise Functions
« on: March 18, 2005, 10:47:16 AM »
Like AND, OR, and XOR.
Infact, just AND, OR, and XOR.

(And not just in the conditions, in the actual gene itself too, darnit.)

(For those who don't understand how they work, you hafta look at the number in binary to fully understand.
AND checks each bit of two values, and unless both are 1, the result will be 0.
I.E.
10100101 AND
00101101 equals
00100101.

OR checks each bit of the two values, but unlike AND, only one of the two bits have to be 1 for the result to be 1.
I.E.
10100101 OR
00101101 equals
10101101.

And XOR checks each bit of two values, but unlike AND and OR, it only results in 1 if ONE (and no more then one) of the bits is 1. (They basically have to be different. The bits, that is.)
I.E.
10100101 XOR
00101101 equals
10001000.)

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7714
    • View Profile
Bitwise Functions
« Reply #1 on: March 18, 2005, 11:08:29 AM »
What use would they be.  I'm not saying they have none, just that I don't see what a bot could do with them off the top of my head.

Offline Anonomous Guest Person

  • Bot Builder
  • **
  • Posts: 85
    • View Profile
Bitwise Functions
« Reply #2 on: March 18, 2005, 05:24:56 PM »
No one can think of an idea on the top of their heads. :P
Heck, I'm sure they had no idea what use writing would've had, and yet it's one of the most used inventions ever, well, invented. :P

Offline Endy

  • Bot Overlord
  • ****
  • Posts: 852
    • View Profile
Bitwise Functions
« Reply #3 on: March 19, 2005, 02:56:58 AM »
You can make at least some "conditions" in the genes. It can be a bit tricky getting to a comparision mode with a final 1 mult(activate) or 0 mult(deactivate), but I think there should be some "cost" for not using normal conditions.

I worked out a Single Store combat bot once, as sort of a challenge, using a method of disabling all but the desired value/storage location then adding all the values/storage locs together(Sorry I can't really describe it better :lol: ). This would basically be what your talking about with OR and XOR, in the action step.

Endy B)

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7714
    • View Profile
Bitwise Functions
« Reply #4 on: March 22, 2005, 03:18:35 AM »
We can add them no problem.  XOR, NOT, OR, and AND are the 4 basic building blocks of all higher functions, like add and mult.  So I guess having them could allow for some non-standard mathematics to develop.

And it would put us on par with Avida.  They have bitwise mutations to achieve simple arithmatic.  We could then run some avida like sims in DB.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
    • DJ Paul Kononov
Bitwise Functions
« Reply #5 on: March 22, 2005, 02:28:47 PM »
ok , add them. (I still think it will only cause more bugs though)
« Last Edit: March 22, 2005, 02:41:26 PM by Botsareus »

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7714
    • View Profile
Bitwise Functions
« Reply #6 on: September 22, 2005, 12:09:04 AM »
I just finished the code for this.  I'm debugging and testing now.

I may convert the entire stack to a series of bits so I can handle overflow errors easier.  For instance, 32000 ^ 32000 is a nightmare for the built in mod function.  But that may slow down the stack functions a tad, which wouldn't be good...  Damn I wish VB had built in bit functions.

Anyway, this creates a nice continuum between the most basic commands (bitwise AND, OR) and some of the more advanced commands (like pyth, finddist, etc.)  I'm postpoing work on optimization until I make some very important decisions.