Hacker News new | ask | show | jobs
by taeric 4380 days ago
I'm not entirely sure you would necessarily need more lines of code to express it in python or Javascript, to be honest. I'll see if I can give it a shot this weekend. Curious to really know. You could certainly use more, but the same could be said of Haskel, as well.

But I'm not necessarily trying to make a claim that it can't be done in Haskel. More that I have not seen it done. You can claim that the final polish of the original is irrelevant, but I find that claim hard to believe. Especially since I have yet to see an example that has said polish.

Sadly, I don't know how you would really go about proving that one way or the other.

1 comments

I never claimed that the polish of the UI in the original was irrelevant.
So, I realize the odds are rather low you will see this. I took a stab at implementing 2048 in javascript. Depending on what you mean by "many more lines," I'm not sure I agree still. For a hardcoded 4x4 grid, I'm only at 100 lines of code in javascript. (For arbitrary rectangular boards, I'm at 130.)

I'm not going to claim that the code alone is as "pretty" as the Haskel version, but I see no reason it should have exploded to be much larger. I may have to take a look at how other folks are doing this.

(Code is currently at https://github.com/taeric/2048-Explorations. Will try to prettify and publish the org file that accompanies it.)

:) Then I am continuing to talk right past you. Apologies.

I'll hopefully have more to add to the conversation after I try this game in a language. At face value, I am not at all clear on how this will take 90 lines of javascript. That just seems extreme.