Re: [Haskell-cafe] Functional board games
Hi Dougal, > Does anyone know of functional-style implementations of > chess/draughts/go/anything else that might give me ideas? there's the Mate-in-N solver in the nofib suite: ftp://www.cs.york.ac.uk/pub/haskell/nofib.tar.gz It takes quite a simple approach, representing the board as two lists (white and black) of piece/square pairs, where a square is just a pair of ints. Matt. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Functional board games
On Mon, Apr 21, 2008 at 5:08 PM, Ryan Ingram <[EMAIL PROTECTED]> wrote: > Bertrand Felgenhauer[1] wrote a peg solitaire game[2] using Prompt[3] > to interact with the user. Thanks to everyone for the suggestions, particularly the Games page on the Haskell wiki which didn't appear in all my googling atttempts. Also, I had been hoping to have a go with Prompt after I saw it first time round but couldn't remember what it was called! So thanks to Ryan for bringing it up again. Cheers, D. -- Dougal Stanton [EMAIL PROTECTED] // http://www.dougalstanton.net ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Functional board games
Bertrand Felgenhauer[1] wrote a peg solitaire game[2] using Prompt[3] to interact with the user. Here's the core game loop: -- move a peg into a certain direction data Move = Move Pos Dir -- solitaire interface data Request a where RMove :: Board -> [Move] -> Request Move -- select a move from given list RDone :: Board -> Int-> Request () -- game over -- implement the game logic game :: Prompt Request () game = game' start -- find possible moves, end game if there are none, otherwise ... game' :: Board -> Prompt Request () game' b = do let options = filter (validMove b) allMoves if null options then prompt $ RDone b (length (pegs b)) else game'' b options -- ... prompt for a move and execute it game'' b options = do Move (x, y) d <- prompt $ RMove b options let (dx, dy) = delta d game' (Board (board b // [((x, y), Empty), ((x + dx, y + dy), Empty), ((x + 2*dx, y + 2*dy), Peg)])) -- ryan [1] http://www.haskell.org/pipermail/haskell-cafe/2008-January/038301.html [2] http://int-e.home.tlink.de/haskell/solitaire.tar.gz [3] http://hackage.haskell.org/cgi-bin/hackage-scripts/package/MonadPrompt-1.0.0.1 On Mon, Apr 21, 2008 at 8:22 AM, Dougal Stanton <[EMAIL PROTECTED]> wrote: > I'm having a go at making a functional board game (the back-end logic > for one, at least) and as with all good projects it raises lots of > questions. But I'll keep it to one this time. > > Does anyone know of functional-style implementations of > chess/draughts/go/anything else that might give me ideas? I am writing > a game of Thud (yes, from the Terry Pratchett book...) but I don't > hold much hope of their being a functional-style Thud game already in > existence! > > Cheers, > > D. > > -- > Dougal Stanton > [EMAIL PROTECTED] // http://www.dougalstanton.net > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Functional board games
bulat.ziganshin: > Hello Dougal, > > Monday, April 21, 2008, 7:22:49 PM, you wrote: > > > Does anyone know of functional-style implementations of > > chess/draughts/go/anything else that might give me ideas? I am writing > > once we have seen 100-line chess published in this list > There's more than a dozen games here, http://haskell.org/haskellwiki/Applications_and_libraries/Games including hsChess. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Functional board games
Hello Dougal, Monday, April 21, 2008, 7:22:49 PM, you wrote: > Does anyone know of functional-style implementations of > chess/draughts/go/anything else that might give me ideas? I am writing once we have seen 100-line chess published in this list -- Best regards, Bulatmailto:[EMAIL PROTECTED] ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Functional board games
Ralph Glass has a Xiang Qi board: http://xiangqiboard.blogspot.com/ On Mon, Apr 21, 2008 at 11:22 AM, Dougal Stanton <[EMAIL PROTECTED]> wrote: > I'm having a go at making a functional board game (the back-end logic > for one, at least) and as with all good projects it raises lots of > questions. But I'll keep it to one this time. > > Does anyone know of functional-style implementations of > chess/draughts/go/anything else that might give me ideas? I am writing > a game of Thud (yes, from the Terry Pratchett book...) but I don't > hold much hope of their being a functional-style Thud game already in > existence! > > Cheers, > > D. > > -- > Dougal Stanton > [EMAIL PROTECTED] // http://www.dougalstanton.net > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- I try to take things like a crow; war and chaos don't always ruin a picnic, they just mean you have to be careful what you swallow. -- Jessica Edwards ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe