| Simon McGregor on Thu, 5 Aug 2010 10:36:42 -0700 (MST) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: [game-lang] defining static parts of games |
On Thu, Aug 5, 2010 at 5:27 PM, Joel Uckelman <uckelman@xxxxxxxxx> wrote:
> Some repetition syntax would be nice. I sort of feel like doing this:
>
> for (int r = 0; r < 4; r++) {
> for (int c = 0; c < 4; c++) {
> printf("hex([%d,%d])", c, r);
> }
> }
Ergggghhh. Please, please don't ;-)
> where the loop is *not* part of the logic program----rather, it means
> that "hex[c,r]" will be printed into the program the desired number of
> times. (Metaprogramming can be quite handy.)
>
> Or, perhaps, just do this:
>
> hex([c,r]) :- 0 <= c & c < 4 & 0 <= r & r < 4.
I much prefer this.
> What else is going on here?
>
> * There is arithmetic.
Hurray! ;-)
> * There are some other functions which are not boolean-valued [...]
>
> col(a)+1 = col(b)
>
> gets translated to:
>
> col(a,c+1) & col(b,c)
>
> where c is a free variable. I find this harder to read.
Me too.
However, this doesn't have to reflect anything in the underlying
language model.
It could be pure syntactic sugar, with
col(a) + 1 = col(b)
being internally translated into
exists((c, d), _col(a, d) and _col(b, c) and equals(d, plus(c, 1)))
...although on second thoughts, we don't really want to be able to
quantify over the integers. That's a quick route to doom.
Simon
_______________________________________________
game-lang mailing list
game-lang@xxxxxxxxx
http://lists.ellipsis.cx/mailman/listinfo/game-lang