# Programming for fun, not profit

**URL:** <https://boards.straightdope.com/t/programming-for-fun-not-profit/429978>\
**Category:** Factual Questions\
**Created:** [December 14, 2007, 8:09am UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978 "2007-12-14T08:09:17Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frylock](https://avatars.discourse-cdn.com/v4/letter/f/ce7236/32.png) [@Frylock](https://boards.straightdope.com/u/Frylock)\
**Post date:** [December 14, 2007, 8:09am UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978/1 "2007-12-14T08:09:17Z")

</div>

Back in high school I liked writing programs.

But all I knew was BASIC.

I’d like to toy around with programming again. I have absolutely no ambition here, I just want to get a feel for a contemporary computer language (or two) and write some toys.

What kind of toys? I don’t know. Back in high school my crowning achievement was writing a “Tron” game (no AI) and that would be kind of cool.

If I could try my hand at an AI for such a thing that would be cool too.

No fancy graphics necessary for anything I want to do.

I also used to have a program (a little later) that let you program a kind of a “robot” to fight other robots.\* Is there anything like that around today which models itself after contemporary programming languages?

-Kris

\*Boring story about that. I tried to write a sort of ‘evolving’ program somewhat as follows. (I don’t remember the exact details.) I wrote a robot program which concerned itself mostly with defining a way to interpret a set of symbols in a line of data as robot instructions. I then gave two versions of this robot two different initial lines of instruction-data, and let them play a battle. Each robot would then randomly change one bit in its line of data, and fight another battle. Each robot would then compare its performances in the two battles, and “mutate” one bit from the line of instruction-data that version of it had used, and fight the next battle using this mutated version of itself. Next it would compare the new performance with the performance of the version it had spawned from, and make a mutation from the better performer, and so on.

(I’m making some of the above up because I don’t remember exactly how the language worked or how my robots worked, but it was something along the lines of what I’ve described. BTW the program in question was called “Robot Battle.”)

It pretty much did what I wanted it to, in the sense that it did the whole comparison/mutating/fighting cycle correctly. But evolution did not happen. I just got a bunch of robots that stood there doing nothing. Even after _one million_ battles, played over a period of 24 hours or so, nothing interesting evolved. Ah well. Seems like it could have worked. 😕

---

<div class="post-metadata">

**Author:** ![Mangetout](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/mangetout/32/19_2.png) [@Mangetout](https://boards.straightdope.com/u/Mangetout)\
**Post date:** [December 14, 2007, 9:52am UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978/2 "2007-12-14T09:52:16Z")

</div>

There are any number of great, free compilers and interpreters out there. Chances are you already have at least one installed on your machine (your web browser probably includes a Javascript interpreter - you can do a whole lot of fun stuff with that).

Here’s a good place to start looking:

> **[JAVA303 - Situs Game Online Terlengkap dan Mudah Menang](https://www.freebyte.com/)**
>
> JAVA303 ialah situs game online terlengkap no. 1 di Indonesia dengan pelayanan online 24 jam, kami menyediakan link alternatif lainnya yang bisa digunakan.

---

<div class="post-metadata">

**Author:** ![Baron\_Greenback](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/baron_greenback/32/48_2.png) [@Baron\_Greenback](https://boards.straightdope.com/u/Baron_Greenback)\
**Post date:** [December 14, 2007, 11:04am UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978/3 "2007-12-14T11:04:27Z")

</div>

Microsoft have got lots of free development tools available here

[http://www.microsoft.com/express/](http://www.microsoft.com/express/)

---

<div class="post-metadata">

**Author:** ![Capt.Ridley\_s\_Shooting\_Party](https://avatars.discourse-cdn.com/v4/letter/c/cc9497/32.png) [@Capt.Ridley\_s\_Shooting\_Party](https://boards.straightdope.com/u/Capt.Ridley_s_Shooting_Party)\
**Post date:** [December 14, 2007, 1:28pm UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978/4 "2007-12-14T13:28:12Z")

</div>

> [@](#):
>
> It pretty much did what I wanted it to, in the sense that it did the whole comparison/mutating/fighting cycle correctly. But evolution did not happen. I just got a bunch of robots that stood there doing nothing. Even after one million battles, played over a period of 24 hours or so, nothing interesting evolved. Ah well. Seems like it could have worked.

What you described is a genetic algorithm, and yes, they do work, albeit very slowly (they’re essentially hill climbing algorithms). The problem you had probably had to do with your low population size (only two robots - try fifty, it may converge a lot quicker).

> [@](#):
>
> I’d like to toy around with programming again. I have absolutely no ambition here, I just want to get a feel for a contemporary computer language (or two) and write some toys.
> 
> What kind of toys? I don’t know. Back in high school my crowning achievement was writing a “Tron” game (no AI) and that would be kind of cool.

I’d suggest either Java (or C#, they’re nearly the same, but C# has more features) or Haskell. Those are what a lot of universities use to teach first year computer scientists about programming.

---

<div class="post-metadata">

**Author:** ![si\_blakely](https://avatars.discourse-cdn.com/v4/letter/s/d9b06d/32.png) [@si\_blakely](https://boards.straightdope.com/u/si_blakely)\
**Post date:** [December 14, 2007, 1:43pm UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978/5 "2007-12-14T13:43:52Z")

</div>

What about Python , and the PyGame framework. Easy to use, easy to read (the language syntax enforces readability) and very popular.

IDEs are available for Windows, and ActiveState have a really good package.

Si

---

<div class="post-metadata">

**Author:** ![Napier](https://avatars.discourse-cdn.com/v4/letter/n/ce73a5/32.png) [@Napier](https://boards.straightdope.com/u/Napier)\
**Post date:** [December 14, 2007, 1:45pm UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978/6 "2007-12-14T13:45:41Z")

</div>

Good for you!

I second Dominic’s suggestion. I took up C# earlier this year and have had a great time with it. I keep thinking, Wow, that’s a good idea, what a clever way to do that, I can see how that would be useful, etc etc. Microsoft has a free version of VisualStudio on their web site, with your choice of compiler, and C# is one of the options.

Also, I keep seeing books about game programming (in which I’ve never been interested), in Borders and similar chain bookstores. It looks pretty easy to dip your toes in that water.

---

<div class="post-metadata">

**Author:** ![Rysto](https://avatars.discourse-cdn.com/v4/letter/r/ecccb3/32.png) [@Rysto](https://boards.straightdope.com/u/Rysto)\
**Post date:** [December 14, 2007, 5:45pm UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978/7 "2007-12-14T17:45:21Z")

</div>

I would emphatically not suggest trying to take up Haskell. I’m an experienced programmer and I still never been able to fully wrap my head around the concept of a Monad. If you’re going to go the functional language route, ML is quite similar to Haskell in terms of syntax but I think that it would be much easier for a beginning to pick up.

On the more traditional imperative side of things, Python is a popular suggestion these days(personally, I’m not a big fan but then I’ve never actually used the language). I like Java but I’m not sure how good the libraries will be for hobbyist stuff.

---

<div class="post-metadata">

**Author:** ![Shagnasty](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@Shagnasty](https://boards.straightdope.com/u/Shagnasty)\
**Post date:** [December 14, 2007, 6:04pm UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978/8 "2007-12-14T18:04:01Z")

</div>

Python is cool. It is really powerful. You can do things with it in 15 lines of codes that might take 150 lines or even 1500 lines of code in other languages. I wanted to learn a new programming language about a year ago and I picked Python. Like you, I had no pint in mind. Even though I work in IT, we don’t use anything close to Python around here.

---

<div class="post-metadata">

**Author:** ![suranyi](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@suranyi](https://boards.straightdope.com/u/suranyi)\
**Post date:** [December 14, 2007, 6:50pm UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978/9 "2007-12-14T18:50:05Z")

</div>

[QUOTE=Shagnasty]  
Python is cool. It is really powerful. You can do things with it in 15 lines of codes that might take 150 lines or even 1500 lines of code in other languages. I wanted to learn a new programming language about a year ago and I picked Python. Like you, I had no pint in mind. Even though I work in IT, we don’t use anything close to Python around here.  
[/QUOTE]

I work in IT, and we actually DO use Python a lot, specifically because it’s so easy to write new tools in that language. As one of my colleagues once said, “Any task you give me, I can write in Python in half the time and one quarter the lines as it would take me in C.”

Ed

---

<div class="post-metadata">

**Author:** ![Ximenean](https://avatars.discourse-cdn.com/v4/letter/x/aca169/32.png) [@Ximenean](https://boards.straightdope.com/u/Ximenean)\
**Post date:** [December 14, 2007, 7:00pm UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978/10 "2007-12-14T19:00:01Z")

</div>

I second or third Python. It was what got me back into hobbyist programming after a long hiatus - I kind of dropped out of coding when object-oriented languages came along. But Python is fun and easy to code in, and I was creating my own classes before long. Features like list comprehension are cool and were new to me.

And the language is interpreted, so you get instant results and can try things out interactively. But it’s powerful too, there are big, serious applications out there written in Python. Modern IDEs are so far ahead of what I used to use years ago, too. They do take some of the drudgery out of coding.

I wrote a neat little card game in it as a sort of familiarisation exercise. Not using PyGame, which perhaps I should have, but the more general purpose wxPython, with which you can easily create cross platform applications.

---

<div class="post-metadata">

**Author:** ![Frylock](https://avatars.discourse-cdn.com/v4/letter/f/ce7236/32.png) [@Frylock](https://boards.straightdope.com/u/Frylock)\
**Post date:** [December 14, 2007, 7:57pm UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978/11 "2007-12-14T19:57:27Z")

</div>

Thanks for the suggestions everyone. I think I’ll look into Python first.

-Kris

---

<div class="post-metadata">

**Author:** ![suranyi](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@suranyi](https://boards.straightdope.com/u/suranyi)\
**Post date:** [December 14, 2007, 8:24pm UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978/12 "2007-12-14T20:24:16Z")

</div>

[QUOTE=Usram]  
But it’s powerful too, there are big, serious applications out there written in Python. Modern IDEs are so far ahead of what I used to use years ago, too. They do take some of the drudgery out of coding.

[/QUOTE]

Indeed, as I said we use Python as well as C where I work. Python for all our new coding because it’s so much easier. Yet we make large applications out of it. I just checked and one tool has over 10,000 lines of code. (In C it probably would have been 60,000 lines.)

Ed

---

<div class="post-metadata">

**Author:** ![gazpacho](https://avatars.discourse-cdn.com/v4/letter/g/6f9a4e/32.png) [@gazpacho](https://boards.straightdope.com/u/gazpacho)\
**Post date:** [December 14, 2007, 8:50pm UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978/13 "2007-12-14T20:50:15Z")

</div>

I have a question for the python lovers.

What the hell possessed the creators of python to give white space syntactical meaning? This bugs me a lot. Didn’t they learn their lesson trying to figure out what was wrong with a makefile?

Other than that it seems like a pretty decent language. I really like the high precision math part of the language. That is a really useful thing to be put into a language.

---

<div class="post-metadata">

**Author:** ![Ximenean](https://avatars.discourse-cdn.com/v4/letter/x/aca169/32.png) [@Ximenean](https://boards.straightdope.com/u/Ximenean)\
**Post date:** [December 14, 2007, 9:20pm UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978/14 "2007-12-14T21:20:08Z")

</div>

A makefile? That’s something you use when you have to compile programs before they can run, right? 😉

---

<div class="post-metadata">

**Author:** ![Napier](https://avatars.discourse-cdn.com/v4/letter/n/ce73a5/32.png) [@Napier](https://boards.straightdope.com/u/Napier)\
**Post date:** [December 14, 2007, 9:24pm UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978/15 "2007-12-14T21:24:38Z")

</div>

gazpacho, there’s a great book out there called The Best Software Writing I: Selected and Introduced by Joel Spolsky, and the 1st (I think) essay is about why we should enforce whitespace convention - as in prettyprinting - in languages as syntactical and not just stylistic. I loved this essay and most of the book.

The idea is that following a good and consistent whitespace convention is very helpful in understanding what you write and relating it to what you mean.

The downside to most languages is that whitespace conventions aren’t syntactical and so they represent a whole separate channel of information that we’re supposed to manage and the compiler’s supposed to ignore. So, why not speak the same language, and use the whitespace we’re already trying to manage?

Sounds like a good idea to me - though I don’t use Python.

---

<div class="post-metadata">

**Author:** ![Balthisar](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/balthisar/32/2825_2.png) [@Balthisar](https://boards.straightdope.com/u/Balthisar)\
**Post date:** [December 14, 2007, 9:38pm UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978/16 "2007-12-14T21:38:12Z")

</div>

I dabble with a little Python for my XBMC stuff. I hate it. Godforsaken white space actually meaning something. Makes me think it’s a learning tool, not that there’s anything wrong with that (I miss Object Pascal with a passion).

Because I only dabble (with other people’s code, at that; no from-scratch projects by me), I have a hard time understanding why it’s easier and/or faster than other languages (not including C; I’ll give you that). Is there a standard library that abstracts a lot of things, or is it just more compact in the sense that Objective-C or Pascal, etc., is more compact than C? Hell, everything’s more compact than C for all but STDIO stuff.

---

<div class="post-metadata">

**Author:** ![gazpacho](https://avatars.discourse-cdn.com/v4/letter/g/6f9a4e/32.png) [@gazpacho](https://boards.straightdope.com/u/gazpacho)\
**Post date:** [December 14, 2007, 9:50pm UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978/17 "2007-12-14T21:50:00Z")

</div>

I read that article Napier. It made some good points. I think he is over estimating the costs of people working on the project with competing styles.

I guess my real complaint is 8 spaces could be seen as different than a tab.

---

<div class="post-metadata">

**Author:** ![Aioua](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@Aioua](https://boards.straightdope.com/u/Aioua)\
**Post date:** [December 14, 2007, 10:05pm UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978/18 "2007-12-14T22:05:12Z")

</div>

Obligatory [Python](http://xkcd.com/353/) link.

---

<div class="post-metadata">

**Author:** ![Superfluous\_Parentheses](https://avatars.discourse-cdn.com/v4/letter/s/8edcca/32.png) [@Superfluous\_Parentheses](https://boards.straightdope.com/u/Superfluous_Parentheses)\
**Post date:** [December 14, 2007, 10:18pm UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978/19 "2007-12-14T22:18:55Z")

</div>

There are a few systems out there that do more or less what you described in your Robot Battle program. Core War and its variants are probably the most direct implementation of the concept. See [Core War - Wikipedia](http://en.wikipedia.org/wiki/Core_War) if you’re interested.

As for programming languages, I would recommend you use a high-level language that’s reasonably well structured, lets you develop quickly and supports multiple paradigms (especially, it shouldn’t force you to do everything in a functional or object-oriented style, but it should support both). As far as I’m concerned that means Java, the Visual Basic variants and C# are out. If you’re thinking of ever switching to a Mac or Linux VB and C# should be out anyway.

Python has been mentioned here a lot, and it’s probably a good fit; it’s fairly fast, easy to develop in and has a pretty large number of extension libraries (so when you decide you _do_ want fancy graphics, you can). It also seems[ to be fairly newbie friendly.

I personally like Ruby better than Python, but that’s really because I think Ruby looks better. Ruby seems to attract programmers that want to warp their language into doing crazy things, while Python seems to be much more strict in how you should implement things. I’ve only used Python a little bit, so I may be wrong.

The main point against Ruby is that the documentation is OK but not great (so you do need a book to get a handle on it) and does not really care about being “safe” for “inexperienced” programmers, only that everything it can do should be easy to do. All the really cool/subversive stuff is right exposed and very tempting to use (and hang yourself with). For some people (me included) that’s a big plus. For others, not so much. I know experienced Java developers who are absolutely horrified about Ruby.

---

<div class="post-metadata">

**Author:** ![Superfluous\_Parentheses](https://avatars.discourse-cdn.com/v4/letter/s/8edcca/32.png) [@Superfluous\_Parentheses](https://boards.straightdope.com/u/Superfluous_Parentheses)\
**Post date:** [December 14, 2007, 10:23pm UTC](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978/20 "2007-12-14T22:23:16Z")

</div>

:smack: Sorry, Core Wars does not do what you’re describing at all. Still, you may want to check it out. It’s a very interesting take on “programming for fun”.

[Next page](https://boards.straightdope.com/t/programming-for-fun-not-profit/429978.md?page=2)
