Basic Mathematics. Log Out | Topics | Search
Moderators | Register | Edit Profile

Zillions of Games Discussion Forum » Desired Features for Zillions of Games » Basic Mathematics. « Previous Next »

Author Message
Malcolm Maynard (Daviim)
Posted on Thursday, June 19, 2003 - 4:00 am:   

Basic Integer Math in ZRF!

It would be ever so nice if ZRF supported some basic math functions with integers, including conditionals (<, >, =, <= and =>) and all that. Nothing too fancy; but it sure would make writing a lot of ZRF files easier for things like keeping some sort of score, if needed...

~*~ Daviim ~*~
daviim@yahoo.ca
Jeff Mallett (Jeffm)
Posted on Friday, June 20, 2003 - 1:03 am:   

+ - * / == != < > <= >=
FYI, I've started working on this and it will be in the next major release.
Malcolm Maynard (Daviim)
Posted on Saturday, June 21, 2003 - 4:58 pm:   

Cool! That will sure make things easier! This using flags for binary counting is all well and good, but trying to do that turns my brain to mush! Or moreso than normal, anyway (ha-ha)

I just had a thought for two logic constructs I just thought of that might be useful a case or elseif for multiple choices in a logic statement which are standard enough in languages like Pascal or C (or variations thereof). It just might tidy up things a spot in a ZRF and make it more readable, if it doesn't really enhance play or performance otherwise. What I was thinking of would probably look something like this:


(case (zone, square or piece name)
(empty? action-1)
(friend? action-2)
(enemy? action-3)
(neutral? action-4)
) ; end case

(if <condition-1?> <action-1>
elseif (<condition-2?> <action-2>)
elseif (<condition-3?> <action-3>)
elseif (<condition-4?> <action-4>)
else <whatever>
) ; end if


As I said, I doubth enhancements like this would make Zillions play stronger, but it should make the logic of a given ZRF a bit easier to follow for anyone creating or editing a ZRF file. I am just a real stickler with things like formatting, layout, and comments whenever I write any kind of programs, which I picked up when I took some basic programming courses way back...

~*~ Daviim ~*~
Claude W. Van Horn (Ropebender)
Posted on Tuesday, November 08, 2005 - 11:38 pm:   

And this would make the language a lot easier for newcomers to adapt to as well. I got lost in the language reference on setting up the binary flags.

Help!!! Help!!

Van!!
Mats W (Kålroten)
Posted on Wednesday, November 09, 2005 - 5:38 am:   

Those basic operations are part of Lisp language. As I understand it, the Zillions interpreter needn't prohibit the use of these operations. For instance, the following expression tests whether the sum of 1 and 4 is greater than 3:
(> (+ 1 4) 3)

So I suspect it would be easy to implement this in Zillions. It's simply to cease prohibiting it. But I'm no expert on Lisp.

Mats
Karl Scherer (Karl)
Posted on Friday, November 11, 2005 - 10:11 pm:   

Someone said over two years ago

"+ - * / == != =
FYI, I've started working on this and it will be in the next major release."

We are still waiting....
Greg Schmidt (Gschmidt)
Posted on Saturday, November 12, 2005 - 2:48 pm:   

Mats wrote:

"So I suspect it would be easy to implement this in Zillions. It's simply to cease prohibiting it. But I'm no expert on Lisp."

I gather that the Zillions developers created their own specialized Lisp-like language as opposed to extending an existing Lisp. So while it may be easy to implement these features I doubt it's quite as simple as no longer prohibiting them.
Claude W. Van Horn (Ropebender)
Posted on Sunday, November 13, 2005 - 10:14 pm:   

Am I missing something, I was not aware that Zillions was a relative of Lisp. Is it a subset? or have you re-invented a new "gaming lisp"? is the language itself extensible (as forth is) or would the entire kernel have to be re-written to add basic integer math?
Mats W (Kålroten)
Posted on Monday, November 14, 2005 - 11:28 am:   

Lisp is remarkable as it is a self-defining language. As it uses sets of atoms (as in set theory) on which are applied concatenation functions, etc, the language is built from its own primitives. So anything you wish can be built into the language. However, commercial versions of Lisp already have these mathematical and logical functions defined, of course. So I thought that they had in some way disallowed them, but perhaps this is their own Lisp variant in which all these mathematical functions haven't been defined yet. It was long ago that I studied Lisp so perhaps my terms here aren't exact.
Greg Schmidt (Gschmidt)
Posted on Monday, November 14, 2005 - 12:21 pm:   

I think it is fair to say that the Zillions language can be considered to be a specialized "gaming lisp". More than anything else, it borrows the syntax of Lisp. It appears to be a subset only in a very limited sense in that the conditional and logical functions correspond to a "real" lisp.

I would not say that the language is extensible in the "forth" sense. The limit of its extensibility lies in the ability of the user to create new functions using the "define" function to create new macros.

Since forth was mentioned, I might add that I used forth in my own generalized puzzle solving engine. Forth gives you alot of power, however, so you must be careful since it is very easy to write code that results in a crash.

Add Your Message Here
Post:
Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action: