Programming Challenges.
- Nidoprince
- Posts: 3
- Joined: Tue Nov 11, 2008 6:24 am
- Location: Montana
- Contact:
Programming Challenges.
Hello. I have solved 30 challenges so far, but they have all been by hand. I have reached the point where I need to know how to code to do very much more. Do any of you have any suggestions for what programming language I should learn and perhaps some resources to learn them in? Any help would be much appreciated.
"Sadness is easier because it is surrender. I choose to fight!"
I tried a lot with javascript...
i was able to solve some of the coding challenges ... but now (ig.:one minute man) i cannot work with it further ...
i'll try with php, cause its very similar to javascript ...
but I think it would be the best to learn c++, basic or sth like that ...
is someone agreeing with this, who is bit more expirienced than I am ?
EDIT: simple question concerning php:
i cannot start a php scripted html site on my lokal pc without a lokal webserver like apache ?
Am I right? i wrote the little Hollo world script, implementated it into an html correctly, but I'm not able to get it started in my webbrowser ...
i was able to solve some of the coding challenges ... but now (ig.:one minute man) i cannot work with it further ...
i'll try with php, cause its very similar to javascript ...
but I think it would be the best to learn c++, basic or sth like that ...
is someone agreeing with this, who is bit more expirienced than I am ?
EDIT: simple question concerning php:
i cannot start a php scripted html site on my lokal pc without a lokal webserver like apache ?
Am I right? i wrote the little Hollo world script, implementated it into an html correctly, but I'm not able to get it started in my webbrowser ...
Above all else, I'd recommend Python - it's an easy language to learn, even for beginners, but it scales well with experience. Although I'm a professional C++ programmer, I haven't written a single C++ program to solve anything on this site - it's all been Python apart from some early shell scripts when I didn't know Python so well.
Python is less efficient than C++, largely due to being interpreted, but this usually doesn't matter - the time-consuming challenges here are usually about finding better algorithms, rather than finding more raw computing power.
Regarding testing PHP locally, I've found the same thing - web browsers don't know how to execute scripts via file: links. It's not really their job, but it would be nice if they did. There's probably a firefox extension for it actually.
Apache is very heavyweight - there may be a lighter alternative. But although it's huge, apache is quite easy to set up so I'd just go with that unless you already have something else in mind.
Python is less efficient than C++, largely due to being interpreted, but this usually doesn't matter - the time-consuming challenges here are usually about finding better algorithms, rather than finding more raw computing power.
Regarding testing PHP locally, I've found the same thing - web browsers don't know how to execute scripts via file: links. It's not really their job, but it would be nice if they did. There's probably a firefox extension for it actually.
Apache is very heavyweight - there may be a lighter alternative. But although it's huge, apache is quite easy to set up so I'd just go with that unless you already have something else in mind.
That's interesting, especially coming from you as you're winning pretty much everything!
Runaway is easily solvable using Python (under two seconds per level), and OneOfUs to some degree (some levels took a while for me, but maybe the algorithm needs improving).
I've still been attacking the others with Python, relying on algorithmic changes rather than pure optimisation to speed things up. I had assumed that you guys who have done well with those had just found really good algorithms - if it actually comes down to language, though, maybe I should try recoding some of mine in C++.
Mortal Coil is still my favourite game, because I got bored of improving the algorithm and actually find it more fun to solve by hand, given a better interface than the default flash app.
Modulo is a pain.
Runaway is easily solvable using Python (under two seconds per level), and OneOfUs to some degree (some levels took a while for me, but maybe the algorithm needs improving).
I've still been attacking the others with Python, relying on algorithmic changes rather than pure optimisation to speed things up. I had assumed that you guys who have done well with those had just found really good algorithms - if it actually comes down to language, though, maybe I should try recoding some of mine in C++.
Mortal Coil is still my favourite game, because I got bored of improving the algorithm and actually find it more fun to solve by hand, given a better interface than the default flash app.
Modulo is a pain.
When solving Modulo level 50, I had to optimize both the algorithm and the implementation, to the limit I could do. So, I think it will be impossible for me to solve it again with Python or Perl.
And, yes, the other puzzles don't require such extreme optimization, so far. But I still think C++ has much advantage, especially in very high levels.
And, yes, the other puzzles don't require such extreme optimization, so far. But I still think C++ has much advantage, especially in very high levels.
I quite agree!gfoot wrote:Modulo is a pain.
PHP scripts can be executed locally without a web browser. just type './php script.php' where php is an executable.
i agree that python is best for most challenges. i use it to create most of them too.
i've used Java to solve all the puzzles. C++ will probably be slightly faster, but not by much. the algorithm is by far the most important part. for example, ernie did his Mortal Coil solver in python. and i'm willing to bet that tails' Pusherboy solver could be coded in basic and still whoop everybody else, its algorithm is so good...
i agree that python is best for most challenges. i use it to create most of them too.
i've used Java to solve all the puzzles. C++ will probably be slightly faster, but not by much. the algorithm is by far the most important part. for example, ernie did his Mortal Coil solver in python. and i'm willing to bet that tails' Pusherboy solver could be coded in basic and still whoop everybody else, its algorithm is so good...
- Nidoprince
- Posts: 3
- Joined: Tue Nov 11, 2008 6:24 am
- Location: Montana
- Contact:
Thanks
Thank you for your prompt replies. I think I will attempt to learn python and then learn C++ when I get a little better. Just out of curiousity is it possible to solve these challenges with lisp?
"Sadness is easier because it is surrender. I choose to fight!"
In my opinion, lisp is also a good choice if you are already used to it.Nidoprince wrote:Just out of curiousity is it possible to solve these challenges with lisp?
That's very impressive! It's also impressive that you solved Modulo level 50 with Java. It seems it's time to withdraw my words.adum wrote:ernie did his Mortal Coil solver in python.
Yes, it would catch up to the current last level soon. But I'm confident that the C++ code will eventually win if the two continue to compete in further levels.adum wrote:and i'm willing to bet that tails' Pusherboy solver could be coded in basic and still whoop everybody else, its algorithm is so good...
Actually, most of my solvers require much memory, and so I want to control the memory representation in detail, in order to hold as much data as possible. Sadly, my laptop equips only 1GB memory, and Vista takes most of them.
Re: Programming Challenges.
Learn Ruby. It's a very powerful language, with a very clean syntax (easy to write and read), and it can be used interactively, which is very important for learning because you can try out things without running a compiler over and over again on temporary files.Nidoprince wrote:Hello. I have solved 30 challenges so far, but they have all been by hand. I have reached the point where I need to know how to code to do very much more. Do any of you have any suggestions for what programming language I should learn and perhaps some resources to learn them in? Any help would be much appreciated.
I recommend you buy the book "Programming Ruby" by Dave Thomas et. al. The first edition is available online, for free.
If you have some sense of humor, you should try out why's (poignant) guide to ruby. That's simply brilliant (I don't know of anything comparable for any other language).
I strictly advise against learning Java or C++ at this point (unless you're trying to get an industry job ASAP). Those are crappy, extremely unfun languages, and don't let people tell you otherwise (it's easy to get fooled here, because those languages are the current industry standards).
Lisp is vastly underrated due to its unusual syntax. Many people who know a lot more about programming languages than I do agree that Lisp is one of the most powerful languages out there (some even say "the most powerful").tails wrote:In my opinion, lisp is also a good choice if you are already used to it.Nidoprince wrote:Just out of curiousity is it possible to solve these challenges with lisp?
There's a wonderful series of video lectures about Lisp and programming. Totally recommended to beginners and experienced programmers alike. They teach some incredible magic in the second lecture already...
Java is almost as fast as C(++), although more memory intensive in most cases. Modern Java runtime environments apply extremely sophisticated optimizations -- and they can optimize some things even better than any C++ compiler, because it happens at RUNtime.It's also impressive that you solved Modulo level 50 with Java. It seems it's time to withdraw my words.
That's not to say that Java (the language) is better than C++. They are both extremely awkward and ugly, but at least in Java you don't have to do your own memory management.
This might be a scenario where C(++) beats Java because you have more control over memory management and use less memory to begin with.Actually, most of my solvers require much memory, and so I want to control the memory representation in detail, in order to hold as much data as possible. Sadly, my laptop equips only 1GB memory, and Vista takes most of them.:(
I really have to start looking into doing the puzzles soon ;-).
Unless you've got Apache installed already (easy under most Linux distributions), there's not much reason to use it outside of a production environment.gfoot wrote:Apache is very heavyweight - there may be a lighter alternative. But although it's huge, apache is quite easy to set up so I'd just go with that unless you already have something else in mind.
There are quite a few attractive light-weight alternatives available for development (and production use, too!):
- lighttpd
- Mongrel (Ruby)
- Jetty (Java, super-light Servlet container)
- (...I'm sure there is a Python one as well...)
- etc.
Last edited by sigi on Mon Nov 17, 2008 1:52 am, edited 1 time in total.
- Nidoprince
- Posts: 3
- Joined: Tue Nov 11, 2008 6:24 am
- Location: Montana
- Contact:
At a loss.
Now, I am at a loss. I began reading Why's Poignant Guide to Ruby and found it to be an amazing book. Yet Lisp also draws me for reasons I can not comprehend. In addition Python's use of white space has a certain appeal to me and it seems to be the most practical. Is it possible to learn 3 languages at one? Even 2? Or will this just cause you to get all the syntax mixed up? I can see how it might mess you up but perhaps learning multiple languages from the beginning would reduce constraining my thinking to a single language? What say ye, wise sages of the internet?
"Sadness is easier because it is surrender. I choose to fight!"
Re: At a loss.
It is. Don't be misled by the lightheaded approach (comic strips and all), the author is a true Ruby wizard with quite a few excellent additions to the Ruby world under his belt (apart from that tutorial book).Nidoprince wrote:Now, I am at a loss. I began reading Why's Poignant Guide to Ruby and found it to be an amazing book.
Lisp is very cool -- wait until you learn about higher-order procedures and macros: that's when the real fun starts (although you can have a lot of that with Ruby as well). I can only repeat my above advice to download and watch the video lectures that I've linked.Yet Lisp also draws me for reasons I can not comprehend.
Yes, that is very practical, and I'm sad that Ruby doesn't do it that way. On the other hand, Python does not provide "lexical scoping", which does make certain things really very awkward. Maybe you have noticed that one has to put "self" into the parameter list of every method, which has to do with the lack of lexical scoping. It's probably the reason why I haven't touched Python yet, it's a very ugly aspect of that language.In addition Python's use of white space has a certain appeal to me and it seems to be the most practical.
It's important that you learn some important concepts, and you can do that with any of the mentioned languages. The syntax differences are not the problem, it's the fact that the various languages usually ask for different styles of programming (e.g. functional vs. imperative, or object-oriented vs. procedural), and it takes time to get into the respective mind-sets.Is it possible to learn 3 languages at one? Even 2? Or will this just cause you to get all the syntax mixed up? I can see how it might mess you up but perhaps learning multiple languages from the beginning would reduce constraining my thinking to a single language? What say ye, wise sages of the internet?
Oh, and a major part of learning any language is getting to know the libraries and tools! Learning all the APIs, and IDEs and whatnot to actually being able to effectively work takes a lot longer than digging the syntax and underlying concepts of a given language. I'm a Java programmer for years now and I still don't know a lot of the sizeable standard library... same goes for Ruby and so on.
Having said that, I can only encourage you to look at all of them (languages) and decide for yourself what you like best. Even if you don't end up using, say, Haskell or Lisp, it will make you a much better programmer in the end to know how these languages work. Keep in mind that in order to be able to pick the right tool for the job at hand, you have to know what's available.
It's simply not enough to learn Java and stop right there. Sure, pretty much all problems can solved in Java, and it's easy to get a Java job, but for a lot of tasks it's simply the wrong tool (and the same is true for all other languages).
At the end of the day, you should also take a look at C programming, and get some practice with pointer arithmetic and doing your own memory management. This will give you a much better understanding what's actually going on inside your machine (while the higher-level languages abstract away a lot of this, which is usually very good for productivity, you will sometime need the judgement of what "really" happens at a lower level, and a good way to learn that is to do some C programming).