Joel Uckelman on Thu, 5 Aug 2010 07:36:42 -0700 (MST) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [game-lang] dice rolls |
Thus spake Marc Lanctot: > > >> 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? > > How would we use this? > > For example, consider the following game. I roll a 3d6, and add the > numbers to get my score. Then you roll a 3d6 and add the numbers to get > your score. The winner is player with the highest score, or a draw if it > is a tie. > > How would we go about describing this game? > > I'm having trouble with the logic lingo, so please bear with me. > > # initial state S_0 > # collection of .. atoms? .. facts? ..? > players(player1, player2) # players is a list Whether something like this should be a list or a series of individual player() predicates is something I've been wondering about, and also about the impact that something like this could have on the difficulty of specifying rules for games with, say, 2-5 players. > score(player1, 0) > score(player2, 0) > turnplayer(player1) > > # collection of predicates.. rules? > > roll(nds,l) :- > list(l) & size(l) == n & forall(x,(in(x,l) -> (1<= x & x<= s))) > > nextplayer(player1, player2) > nextplayer(player2, player1) > > # using syntax from http://en.wikipedia.org/wiki/Fluent_calculus > > State(Do(myroll), s)) o score(x, sc) o turnplayer(x) = > > State(s) o roll(3d6, l) o sum(l) == n o score(x, sc + n) > o nextPlayer(x,y) o turnplayer(y) > > # end of the game predicate > > end(s) :- > forall(p, in(p, players) -> score(p, x) & (x > 0)) I think the combination of this with nextplayer means that it would still be someone's turn after the game ended. > Is this the kind of this we want? It's kind of what I want, but only kind of. I'm still not finding the fluent calculus syntax very perpicuous, and it seems like there's not clear separation between the definition of initial state, general rules, and state change. I think it's important that we have this so as not to end up with a big ball of mud. http://en.wikipedia.org/wiki/Big_ball_of_mud -- J. _______________________________________________ game-lang mailing list game-lang@xxxxxxxxx http://lists.ellipsis.cx/mailman/listinfo/game-lang