Code center > Darwinbots3

Boolean memory

<< < (3/5) > >>

Botsareus:

--- Quote ---I've implemented the in-place condition programming I talked about in another thread.  stores and codule calls (not implemented yet, but it will be) will still pull values from the stack, but nothing will happen if the top value on the bool stack is false.  An empty bool stack is treated as true.

--- End quote ---

Can you give an example?

Numsgil:

--- Code: ---false
10 20 store
*20

--- End code ---

Try that in the interpreter.  You should get back 0 on the stack.  Meaning that the store to memloc 20 didn't happen.

Compare with this code:

--- Code: ---true
10 20 store
*20

--- End code ---

Botsareus:
oh, ok (I still can not find the thread with your interpreter though, I hope it is an exe...)

Numsgil:
Try this thread

It was stickied at the top of the forum.

Botsareus:
somewhat related:

Can we add inttobool and booltoint?

inttobool takes (duplicate into memory) a number on the integer stack converts it to a bool ( int > 0) and does a push into the bool stack
booltoint takes (duplicate into memory) a boolean on the bool stack converts it to an integer (0 or 1) and does a push into the integer stack

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version