[Haskell-cafe] Tetris

CW Anderson anderson at cs.colostate.edu
Mon Nov 19 17:30:11 EST 2007


To help learn some Haskell, I implemented a pole-balancing video game in
Haskell, starting with the code for the S.A.R.A.H. road simulator by
Maurício C. Antunes (thanks Maurício) that is included in the Gtk2Hs library
demos.  It demonstrates how to do the graphics, interact with the user via
mouse buttons, and the use of IORef to maintain the state.  You can download
my implementation at

http://www.cs.colostate.edu/~anderson/code/haskell/Pole.hs

Chuck Anderson


Andrew Coppin wrote:
> 
> If you were going to implement Tetris in Haskell, how would you do it?
> 
> (For that matter, has anybody already *done* it? It would probably make 
> a nice example program...)
> 
> I'm particularly interested to know
> 
> 1. How exactly would you do the graphical components? (Presumably 
> there's some deep trickery with Gtk2hs that can draw free-form stuff 
> like this.)
> 
> 2. How do you implement a program that is fundamentally about state 
> mutation in a programming language which abhors state mutation?
> 
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> 

-- 
View this message in context: http://www.nabble.com/Tetris-tf4839853.html#a13846985
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list