Bots and Simulations > DNA - General

If - Elseif - Else

<< < (2/3) > >>

Prsn828:
This isn't worth putting in a new topic, but how exactly do you use else, because from what I understand the boolean stack is anded when you reach the start after a cond, so does this mean you can only have one else per gene?

Moonfisher:
I'm not sure else even works... was suposed to be :
cond
start
else
stop

I think... but not so sure it actualy works properly...

But it's kinda funny people are discussing this, I'm currently working on a perl script to translate a C like syntax to DB code
It was only suposed to be a very simple and strict syntax at first, but the whole thing kind of grew as I got the idea to let people declare macros and operators themselves
So still need to get that sorted out, but I finaly know exactly how it's gonna work... sort of...
But then I also need to make it possible to use functions... and haven't gotten around to think that through yet so... not sure how much longer I'm gonna be.
And ofcourse it won't be C... it'll be my own very strict and simple version of C... but I think it's going to turn out pretty well, personaly plan to use for bot creation in the future.
(Also planning for this first verion to SG'fy everything and add a hibernate condition if the var is defined, so making a hibernating bot will be easyer than ever)

Anyway still got some work to do... but the whole syntax and how to use it has taken shape (Except for functions) and personaly I like the outcome, lets hope I'm not the only one
(I know one can use PyBot... but I like the C syntax and wanted to do something with perl... and planning on adding headers with all the operators and some good macros and such, then poeple can just overload the operators if they need things to work differently)

Prsn828:

--- Quote from: Moonfisher ---I'm not sure else even works... was suposed to be :
cond
start
else
stop

I think... but not so sure it actualy works properly...

But it's kinda funny people are discussing this, I'm currently working on a perl script to translate a C like syntax to DB code
It was only suposed to be a very simple and strict syntax at first, but the whole thing kind of grew as I got the idea to let people declare macros and operators themselves
So still need to get that sorted out, but I finaly know exactly how it's gonna work... sort of...
But then I also need to make it possible to use functions... and haven't gotten around to think that through yet so... not sure how much longer I'm gonna be.
And ofcourse it won't be C... it'll be my own very strict and simple version of C... but I think it's going to turn out pretty well, personaly plan to use for bot creation in the future.
(Also planning for this first verion to SG'fy everything and add a hibernate condition if the var is defined, so making a hibernating bot will be easyer than ever)

Anyway still got some work to do... but the whole syntax and how to use it has taken shape (Except for functions) and personaly I like the outcome, lets hope I'm not the only one
(I know one can use PyBot... but I like the C syntax and wanted to do something with perl... and planning on adding headers with all the operators and some good macros and such, then poeple can just overload the operators if they need things to work differently)
--- End quote ---

Actually, I could probably write something myself.
Too bad I'm too lazy, lol, but keep it up, I'll be expecting to see the results when you get done.

Oh, don't hold your breath on functions, any recursion would instantly disallow it from working with functions.
Without recursion it is just sticking the same code anywhere the function is called.

Shasta:

--- Quote from: Moonfisher ---cond
start
else
stop
--- End quote ---
Else on the wiki: Identical to start except it is executed if the previous condition resolved FALSE.

Else really is not very flexible, to me just using the boolean stack is easier (now) and more powerful.

Prsn828:

--- Quote from: Shasta ---Else really is not very flexible, to me just using the boolean stack is easier (now) and more powerful.
--- End quote ---

How exactly do you "Just use the boolean stack" ?
I have yet to see anyone explain this.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version