game engine (as in rules not graphics)
Aaron Brady
castironpi at gmail.com
Mon Dec 29 09:52:47 EST 2008
On Dec 29, 4:14 am, Martin <mar... at marcher.name> wrote:
> Hi,
>
> 2008/12/29 Phil Runciman <ph... at aspexconsulting.co.nz>:
>
> > See: Chris Moss, Prolog++: The Power of Object-Oriented and Logic Programming (ISBN 0201565072)
>
> > This book is a pretty handy intro to an OO version Prolog produced by Logic Programming Associates.
> > From: Aaron Brady [mailto:castiro... at gmail.com]
> > Sent: Sunday, 28 December 2008 1:22 p.m.
> > Not my expertise but here are my $0.02. You are looking for ways to represent rules: buying a house is legal in such and such situation, and the formula for calculating its price is something. You want "predicates" such as InJail, OwnedBy, Costs.
>
> > Costs( New York Ave, 200 )
> > InJail( player2 )
> > OwnedBy( St. Charles Ave, player4 )
> > LegalMove( rolldie )
> > LegalMove( sellhouse )
>
> I'm not sure I'm looking for prolog, i had an introductory course back
> at the university but it didn't exactly like it. I'm after some info
> how such rules would defined in python (specifically python althou
> logic programming is probably the more appropriate way).
>
> I guess I'm missing quite some basics in the design of such concepts,
> I'll head back to google to find some introductory stuff now :).
snip
It depends on what you want to do with it. Do you want to answer a
question about whether something is legal? Do you want a catalog of
legal moves? Do you want to forward-chain moves to a state? Do you
want just a representation for its own sake?
For instance, the game just started. Player 1 landed on Oriental,
bought it, and Player 2 landed in the same place. Here are the legal
possibilities.
Player 1 offers to sell Oriental to Player X.
Player X offers to buy Oriental from Player 1.
Player 1 mortgages Oriental.
Player 1 collects rent from Player 2.
Player 3 rolls dice.
Thinking aloud, I think the closest thing to predicates you'll have in
Python is to build a Relation class or use a relational database.
Some tables you might use are: Property( id, name, price, rent0houses,
rent1house, ..., numhouses, mortgaged, owner ). Player( id, location,
money ). LastMove( player.id ).
P.S. There is 'pyprolog' on sourceforge; I did not check it out.
More information about the Python-list
mailing list