jump to navigation

Project Euler June 24, 2008

Posted by blueapple in Other, Programming.
3 comments

I’ll have to admit it, Project Euler has got me hooked for the last few weeks. It all started with a friend asking me for help regarding a math problem. It didn’t take long before we had figured it out, but I was interested where he got it from, as it involved writing a program to generate the solution.

Project Euler, he said.

To summarize the whole thing: It is a website which presents various (At the time, 199) math/programming problems. Once you have submitted the correct answer, you’ll be given access to a forum thread where people post their solutions and thoughts about the problem. In some cases, there is even a pdf-file explaining the problem (and how to solve it efficiently). You’ll be amazed how some people solve the problems. Me sitting there, proud of my 100 lines of code and seeing a solution in two lines that generates the solution five times as fast. But one learns a lot.

I saw this as an opportunity to learn Haskell too.

Haskell is a standardized purely functional programming language with non-strict semantics, named after the logician Haskell Curry.

Wikipedia: Haskell (programming language)

It is quite different from C++ (or any imperative programming language). But not different in a bad way. One of the cool things with it is what is called “lazy evaluation”. It allows one to declare something which is not computed until it is needed. So you can declare a list of all primes, or a list of the whole Fibonacci sequence (which is infinite). And then, the element you want will be computed only when you need it.

Now, I’m still a beginner with Haskell. But I’m learning more each problem I solve. I would recommend using Project Euler either as a tool to learn a new programming language or just to give you exercise with one you know. It’s a fun challenge, can you make it to100%?

Thoughts on maps May 3, 2008

Posted by blueapple in Hydro, Programming.
add a comment

When coding something like this (Hydro), early in development I’m not really interested in developing tools. I want to get the “thing” done (or atleast close too), not waste time making leveleditors and such. Therefore, I looked around for alternatives this time.

(more…)