Simon McGregor on Tue, 3 Aug 2010 16:09:10 -0700 (MST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [game-lang] dice rolls


If we are going with a GDL-style syntax, I for one am going to have to
learn more about logic programming. Please forgive my ignorance!

On Tue, Aug 3, 2010 at 4:13 PM, Joel Uckelman <uckelman@xxxxxxxxx> wrote:
> The GDL II paper got me thinking about how one could write a predicate
> for rolling dice where the number of dice and number of faces are
> parameters. What I came up with as a first attempt is this:
>
>  roll(nds,l) :-
>    list(l) & size(l) == n & forall(x,(in(x,l) -> (1 <= x & x <= s)))
>

This reads "l is a roll of NdS if l is a list of N numbers between 1
and S", right?

> (I'm trying to write something GDL-looking, but not necessarily something
> which is well-formed GDL. Basically, I'm writing something I would like
> to be well-formed in the language we develop.)
>
> In roll(nds,l), I'm treating 'd' as a comma, in order that dice rolls
> can be written using the standard notation. This is just syntactic sugar,
> you could just as well write roll(n,s,l).

> There are comparison operators here, and numeric literals, and l is a list
> variable (but maybe we don't need actual list variables---perhaps we can
> already axiomatize all of the features of of lists...).

What would the difference be between these two cases? Does one
correspond to incorporating lists into the language as builtins, and
the other correspond to implementing lists in a library? Or is it
another sort of difference?


Simon
_______________________________________________
game-lang mailing list
game-lang@xxxxxxxxx
http://lists.ellipsis.cx/mailman/listinfo/game-lang