There is an implementation of tetris in haskell with the source code: http://web.comlab.ox.ac.uk/people/Ian.Lynagh/Hetris/ I discovered it when a regular contributor contributed an article on the game to my FOSS gaming encyclopedia.
Could you provide the link to the encyclopedia of yours?
Tetris in Haskell
11–20 of 23 posts
Re: Tetris in Haskell
#12Earlier quoted context omitted.
He says its taken him a week to do it and has had to ask lots of people for help. So I'd say its much harder than in a language like C#. I could (and so could most other people here) make tetris in 1-2 days without help.
But the thing is, functional game development techniques are nowhere near as developed or established as those of OO game development. The solutions to the problems at hand aren't as immediately obvious. This comes to mind: http://prog21.dadgum.com/23.html
If something non-trivial is required for functional programming, then it is more difficult.
Re: Tetris in Haskell
#131. http://www.haskell.org/haskellwiki/Applications_and_librarie...
2. http://www.haskell.org/haskellwiki/Frag
3. http://donsbot.wordpress.com/2009/08/06/haskell-package-popu...
4. http://code.haskell.org/frag/src/ (Darcs 'get' enabled)
Re: Tetris in Haskell
#14Earlier quoted context omitted.
Presumably this is newsworthy because everyone assumes building Tetris in Haskell is harder than in an imperative/OO language. This is a good thing because it proves that it's not.
He says its taken him a week to do it and has had to ask lots of people for help. So I'd say its much harder than in a language like C#. I could (and so could most other people here) make tetris in 1-2 days without help.
This says nothing about Haskell or C, but it does say something about me.
Re: Tetris in Haskell
#15Earlier quoted context omitted.
Yeah, the source code would be very good to see.
If it is programmed in brainfuck though I'm going to eat my hat or something. Do penance in a major way ;)
Re: Tetris in Haskell
#16Earlier quoted context omitted.
If it is programmed in brainfuck though I'm going to eat my hat or something. Do penance in a major way ;)
I'm afraid most brainfuck implementations don't have non-blockind IO; therefore, you can't. Otherwise it would be very fun.
maybe we can 'memory map' some of it ? Subsequent locations in memory that you plot to a screen on over modificiation (b/w would be ok in this case I guess), a bunch of bitfields that get 'latched' whenever a key is pressed that the brainfuck mainloop has to walk by every now and then, resets and uses as branching points ?
That should do it.
It doesn't need blocking io, see. Polling latched inputs is the way the machines of old did it, it's a bit less efficient but it works.
Re: Tetris in Haskell
#17Re: Tetris in Haskell
#18Earlier quoted context omitted.
He says its taken him a week to do it and has had to ask lots of people for help. So I'd say its much harder than in a language like C#. I could (and so could most other people here) make tetris in 1-2 days without help.
FWIW, I would need a week and lots of help to do it in C, but I could probably do it in a few days with Haskell. This says nothing about Haskell or C, but it does say something about me.
I know nothing of your abilities, even so, if haskell is the only language you know well, I'd be impressed if you could make the game as fast as me or most ppl here.
Re: Tetris in Haskell
#19Earlier quoted context omitted.
FWIW, I would need a week and lots of help to do it in C, but I could probably do it in a few days with Haskell. This says nothing about Haskell or C, but it does say something about me.
This is a blog about functional languages, so this man obviously knows a lot about Haskell but still required help for a game that would be prettymuch a hello world for someone in almost any other language. I know nothing of your abilities, even so, if haskell is the only language you know well, I'd be impressed if you could make the game as fast as me or most ppl here.
If your first real program in any language was a Tetris game, you'd probably need some help getting started too.
As shown by the various games posted elsewhere in this thread, there are perfectly trivial and straightforward ways to write games in Haskell. If nothing else, Haskell's "do notation" makes it easy to safely mix imperative programming with pure functional programming.
When people do post about writing a game in a new language as a notable achievement, it's usually because they did it in part to learn a new language (as in this case) or a new concept (like using FRP or Erlang-style message passing, instead of imperative programming with mutable state).
Re: Tetris in Haskell
#20Earlier quoted context omitted.
This is a blog about functional languages, so this man obviously knows a lot about Haskell but still required help for a game that would be prettymuch a hello world for someone in almost any other language. I know nothing of your abilities, even so, if haskell is the only language you know well, I'd be impressed if you could make the game as fast as me or most ppl here.
The first paragraph of the post explains, "it’s my first, real foray into Haskell." If your first real program in any language was a Tetris game, you'd probably need some help getting started too. As shown by the various games posted elsewhere in this thread, there are perfectly trivial and straightforward ways to write games in Haskell. If nothing else, Haskell's "do notation" makes it easy to safely mix imperative…