Joel Uckelman on Wed, 4 Aug 2010 03:08:11 -0700 (MST)


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

Re: [game-lang] a survey of previous work


Thus spake Simon McGregor:
> 
> GALA also shows up the holes in my grasp of logic programming. The
> paper says that they model a game as paths through a program (using
> the "choose" operator, which is nondeterministic). But it makes it
> sound like this is an execution path, and I can't quite get my head
> around how one executes a declarative program. Incidentally, GALA
> (like GDL?) is based on PROLOG - a language I've never used.

Have a look at the article in Wikipedia. on Prolog. A Prolog program
itself doesn't do anything. It's the queries you supply which cause
any computation to happen. A (very) simple example:

  cat(Widget).
  animal(X) :- cat(X).

This program does nothing. However, when I add a query, something
happens. The query is the first line, the output from the Prolog 
interpreter the second:

  ?- animal(Widget).
  Yes

What the Prolog interpreter did was try to falsify animal(Widget),
but it found that it couldn't. Due to the semantics of Prolog, this
means that my query was true. If my query had had free variables in
it Prolog would have found me a true instance:

  ?- animal(X).
  X = Widget

In our case, a query could be a game state, I think, while the
program would be the game rules:

  ?- legal(...).
  Yes

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