Card games

View: New views
6 Messages — Rating Filter:   Alert me  

Card games

by Felipe Lessa :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

I would like to know if anybody has already thought of or tried
to code an EDSL for card games.  Ideally you should be able to
write the rules the games and get "for free":

 - Game generator: given an input deck, construct the initial
   state of the game.

 - Random game generator: besides just creating a random deck and
   using the item above, it should be nice to be able to randomly
   construct the game from the final positions.  This should
   guarantee that all random games are solvable.

 - "Hints" generator: IOW list possible moves given a game state.

 - Playable game: probably the EDSL should include at least some
   information to be able to properly place the cards on the
   screen.

 - Game solver: this is somewhat harder to do efficiently, but an
   inneficient one should be doable.

 - Demo mode: related to the above, an auto-play distract-me mode.

 - Tutorial mode: show a screen for each of the rules written?

 - ...anything more?

Just curious, this looks like a perfect job for an EDSL.  Also, I
guess anybody trying to do something like this should read
PySol's code to have some ideas.

--
Felipe.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Card games

by Joe Fredette :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You might peek at my library HCard (it's on Hackage), it uses  
associated datatypes to allow for a very
general playing-card interface. It was only ever a toy to play w/  
Assoc. types for me, but I imagine it
could be a decent starting point for someone interested in turning it  
into a real EDSL. It's got a
cribbage counter example program bundled with it.

/Joe



On Nov 7, 2009, at 5:54 AM, Felipe Lessa wrote:

> Hi!
>
> I would like to know if anybody has already thought of or tried
> to code an EDSL for card games.  Ideally you should be able to
> write the rules the games and get "for free":
>
> - Game generator: given an input deck, construct the initial
>   state of the game.
>
> - Random game generator: besides just creating a random deck and
>   using the item above, it should be nice to be able to randomly
>   construct the game from the final positions.  This should
>   guarantee that all random games are solvable.
>
> - "Hints" generator: IOW list possible moves given a game state.
>
> - Playable game: probably the EDSL should include at least some
>   information to be able to properly place the cards on the
>   screen.
>
> - Game solver: this is somewhat harder to do efficiently, but an
>   inneficient one should be doable.
>
> - Demo mode: related to the above, an auto-play distract-me mode.
>
> - Tutorial mode: show a screen for each of the rules written?
>
> - ...anything more?
>
> Just curious, this looks like a perfect job for an EDSL.  Also, I
> guess anybody trying to do something like this should read
> PySol's code to have some ideas.
>
> --
> Felipe.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe@...
> http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Card games

by Stephen Tetley-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Felipe

Close (or maybe not...), Martin Erwig and Eric Walkingshaw have a few
papers on embedding a DSL in Haskell for game theory available from
Martin's web site:


http://web.engr.oregonstate.edu/~erwig/papers/abstracts.html

Best wishes

Stephen

2009/11/7 Felipe Lessa <felipe.lessa@...>:
> Hi!
>
> I would like to know if anybody has already thought of or tried
> to code an EDSL for card games.  Ideally you should be able to
> write the rules the games and get "for free":
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Card games

by Matthias Görgens-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Felipe,

Interesting idea.  But I guess you should clarify what kind of card
games you want to support.  E.g, a DSL for trick taking games like
Bridge, Skat or Doppelkopf might be different from one that's good for
Canasta or Rummy.  Or do you aim at Solitaire?  I'd suggest starting
with a very small scope of the domain for a very first version.

Good luck writing a `solver' for Doppelkopf!

Cheers,
Matthias.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Card games

by Felipe Lessa :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Nov 07, 2009 at 08:46:07AM -0500, Matthias Görgens wrote:
> Interesting idea.  But I guess you should clarify what kind of card
> games you want to support.  E.g, a DSL for trick taking games like
> Bridge, Skat or Doppelkopf might be different from one that's good for
> Canasta or Rummy.  Or do you aim at Solitaire?  I'd suggest starting
> with a very small scope of the domain for a very first version.

Hmm, good catch.  I was thinking about solitaire, i.e. single
player, games.  Multiplayer card games certainly have their own
set of interesting challenges.

If I ever get to develop something capable of expressing nicely
Patience, Spider, Pyramid and Black Hole I'll be more than
satisfied :).

Cheers,

--
Felipe.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Card games

by Tom Tobin-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Nov 7, 2009 at 8:07 AM, Felipe Lessa <felipe.lessa@...> wrote:

> On Sat, Nov 07, 2009 at 08:46:07AM -0500, Matthias Görgens wrote:
>> Interesting idea.  But I guess you should clarify what kind of card
>> games you want to support.  E.g, a DSL for trick taking games like
>> Bridge, Skat or Doppelkopf might be different from one that's good for
>> Canasta or Rummy.  Or do you aim at Solitaire?  I'd suggest starting
>> with a very small scope of the domain for a very first version.
>
> Hmm, good catch.  I was thinking about solitaire, i.e. single
> player, games.  Multiplayer card games certainly have their own
> set of interesting challenges.
>
> If I ever get to develop something capable of expressing nicely
> Patience, Spider, Pyramid and Black Hole I'll be more than
> satisfied :).

I'd be interested in something which could model games of Dominion
[1], as it's my current addiction; it's a (non-collectable) card game
where you build and tune your deck as you play, and aside from money
and victory point cards (which are always available) randomly has
available ten possible "action" card types to buy each game (out of
the total set of action card types — 76, as of the latest expansion).
There have already been various basic analyses of various possible
strategies assuming simple rules; if a strategy can't beat the
"baseline" strategy "Big Money" (which involves buying nothing but
money and victory points the entire game), it should probably be
scrapped.

[1] http://www.boardgamegeek.com/boardgame/36218
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@...
http://www.haskell.org/mailman/listinfo/haskell-cafe