Joel Uckelman on Thu, 5 Aug 2010 07:52:01 -0700 (MST)


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

Re: [game-lang] Sequential flow description


Thus spake Simon McGregor:
> Looking at GALA's example code made me realise the importance of
> sequential description in game rules. I'm still in favour of a
> declarative rather than imperative language, but many games heavily
> feature imperative-style turn structure (regular sequential changes of
> state which totally switch the sets of choices available to players).
> We should consider this.
> 
> The English rules "Turns have three different stages. First, stage A,
> where each player chooses a card and they are simultaneously
> revealed... Then, stage B, where the player with the highest card...
> Finally, stage C, in where each player in turn moves their pawn..."
> read far more clearly when written
> 
> sequence(
>    // stage A
>    sequence(
>       [ each player chooses a card ],
>       [ they are simultaneously revealed... ]
>    ),
>    // stage B
>    [ the player with the highest card... ],
>    // stage C
>    [ each player moves their pawn... ]
> )
> 
> than when written in some way which abstracts the flow into a big
> state-switching logic a la fluent calculus, roughly:
> 
> (Player can A_choose(Card)) requires
>   [ in stage A ]
> 
> do(Player, A_choose(Card), unchanged-state plus [ in stage A ]) =
> unchanged-state plus [ in stage B ] plus [ "Player chose Card"
> revealed ]
> 
> ...with the logical flow of the sequence broken up and coded all over
> the place, and requiring relevant states to be turned into named
> facts. Which looks to me a lot like imperative programming implemented
> (inefficiently and unreadably) in a non-imperative language.

This sums up why I'm not finding the fluent calculus to be very nice.
Having to refer to the state explicitly almost everwhere is cumbersome.

...

I keep wanting to think of the game rules as proof rules in a sequent
calculus, the legal games states at the theorems, and paths from the
initial state to legal game states as the derivations...

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