On Nov 19, 2007 9:25 PM, Andrew Coppin <[EMAIL PROTECTED]> 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?
>

It's not really fundamentally about state mutation. The only "state"
you're mutating is when you're actually taking the game board and
rendering it on to the screen, and when you're reading input from the
user to direct the next step in the game. But all of the actual logic
- computing collision detection against the existing grid, computing
the score, rotating blocks, etc. - is completely functional.


-- 
Sebastian Sylvan
+44(0)7857-300802
UIN: 44640862
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to