Freitag, 26. Dezember 2008

Effective C++ - 50 Specific Ways to Improve Your Programs and Design

I'm now reading "Effective C++ - 50 Specific Ways to Improve Your Programs and Design". It's a great book which I would recommend every C++ programmer to read.

I wonder: Why aren't books like this part of the computer science curriculum?

Donnerstag, 25. Dezember 2008


I've asked myself how I would implement such a program. Here are some of my ideas: (In the following paragraphs, I = the program)

Assuming you can only answer "Yes", "No" or "Don't know": I'd start asking a question that eliminates approximately 50% of the possible characters both if you answer with "Yes" or with "No". I'd continue like that until 1 character remains.

Now it might happen that 0 characters remain. In this case, I'd have to reconsider some answers; they might have been wrong. I'd start skipping such an answer first so that only 1 character remains, if possible. Or if not 1 character, then the lowest possible number of characters. Then I'd continue asking questions with the above algorithms.

Akinator also allows answering "Probably yes" or "Probably no". I'd treat these answers as "Yes" or "No", but if I have to reconsider an answer, I'd first reconsider one of these answers. That is, I'd first search for the answer skipping which gives me the lowest possible number of characters in this set of answers.

The database is constructed from what the users teach me. The largest number of "Yes" or "No" answers for each question for each character is stored. That's the data which my guesses will be based on.

I wonder how accurately these ideas match the actual algorithm of Akinator?

Going to bed...

Let's end the Internet session of the day with a smile:


Dienstag, 23. Dezember 2008


Yesterday I started re-reading the recommended textbook on biochemistry. I had this subject 6 years ago and was good at it, but I have forgotten many things. As I spent most of my sparetime in the past few weeks programming, I can directly compare programming and studying biochemistry. My conclusion is that studying biochemistry is much more difficult than programming. Unlike most of medical subjects, biochemistry requires understanding, and that takes more or less time depending on your mental abilities.

I've also started reading a good university script about C++. Now I'm learning how to overload operators, make classes inherit from other classes, use templates etc. Until now I was only a C programmer who had very little knowledge about C++, derived from reading foreign source codes. Until a short time ago, the only C++ specific things I used in my programs where the "new" operator and "//" style remarks... Dealing with OpenGL, I learned to code classes (which I had previously only used in C# and Java). Now I'll become a real C++ programmer.

Homepage updates

I've updated "About Me" and "My Life So Far", covering the most important aspects of what has happened in the most recent 7 years.

Mittwoch, 17. Dezember 2008

Strange dream

Last night I dreamt that Robert Mugabe was singing a Dutch song in the Zimbabwe parliament to celebrate the 4000th anniversary of Israel.

Samstag, 13. Dezember 2008

What we need sleep for

Last night I dreamt that kbfr was debugging part #866 of his Basic 2.0 tutorial in my old flat. And I dreamt a lot more strange things, but I forgot them.

I guess dreams are the root of creativity: In them, unusual associations between various things we experienced and learned are made. So this explains what we need sleep for.

Dienstag, 9. Dezember 2008

Recent dreams

Some nights ago I dreamt reading in a newspaper that las/mercury was the son of a billionaire, had completed high school in only 9 years and had graduated from university after just spending 1 year studying computer science.

In the same night I dreamt that I met a fellow medical student who was spending most of his day training for playing in a jazz band, while working at the Red Cross in the nights. He told me that after his "Berufspraxis", he would become the deputy of a manager of the Red Cross, who had the same surname as one of my neighbors.

Homepage updates

Added two new programs to my homepage: The first one is "Indian Summer", a colourful 256b intro which I made for the 0a000h demoparty. (Don't know yet what place it got.) The second one is a simple demo program for Lagrange Polynomials, which was made for a pouet thread. Enjoy!

Samstag, 6. Dezember 2008

Building a word processor...

Now I'm programming a word processor. I started with Justify1.c from Charles Petzold's book on Windows programming, but discovered that it was buggy: When you resized the window too narrow, it would freeze. Moreover, the last line sometimes exceeded the width of the output rectangle. And there were some other details. I managed to fix all the bugs - now I'm able to output justified text in a rectangle of any size I want. That's a good start.

Freitag, 5. Dezember 2008

Learning to program

I wonder how much time would have been necessary to learn programming to the extent I master it now if all my doing had been directed to this effort. Maybe three years? And I've been programming for 17 years now. Well, I made a long break in which I just edited the diskmag and/or studied medicine, so it's probably just 7 years of programming experience I have in total.