
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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe