Posted on August 7, 2008
Ive seen a lot of programs using enums in txt based config files. Like this, I have two enums;
enum KEYS
{
W, S, A, D
}
enum ACTIONS
{
FORWARD, LEFT, BACK, RIGHT
}
Then I, in the config file, do this:
W = FORWARD
To tie a key to an action. I was looking for the best way to connect the string based “enum” from the textfile to the actual enum in the program. A was pointed to a nice code snippet that I now have modified to better suit my own needs.
more…
0 Comments
• Filed in Code, Python
Posted on June 26, 2008
I found myself needing to split a std::string at a certain char. After a quick google I found that there are quite a few ways to achieve this, so I wrote my own and made it as simple as I wanted it to be. I decided to share the snippet, maybe it helps someone, someday. 
more…
2 Comments
• Filed in C++, Code
Posted on June 16, 2008
The reason I havent posted in a while (which should make me subject to some nasty punishment) is that I have been extremely busy with our game Boingo, which by the way won two categories at this years SGA.
But enough about that. A while ago I talked about syntax highlighting in blogs, but in the end I settled for pastebin. Today I discovered that there has been an update for WP-Syntax, so I decided to try out the update.
Here is some code, with cpp highlight:
#include <iostream>
int main ( void )
{
// do stuff
// ( ... )
return 1;
}
It actually looks good. Ive always preferred to have the code in the posts themselves rather than in a link.
0 Comments
• Filed in Blogging
Posted on March 8, 2008
I’ve been toying around with Trac today. One step in the process is to hash the user passwords.
more…
0 Comments
• Filed in Code, Python
Posted on February 10, 2008
I always comment my code. I even use doxygen syntax in my comments and generate nice looking documentation for the projects. Still, I cant recall ever really looking at them.
more…
0 Comments
• Filed in Organization
Posted on February 4, 2008
A short tutorial I wrote a while back for a friend trying to explain singletons. The reason I felt it needed to be written was that everything I found on the net about singletons was huge multi-page articles, nothing short. So I set out to write one; in less than 500 words. But since then, every time my blog has been reconstructed, the post got lost, but every time a friend have asked me to put it back online. This time around was no exception so here goes!
more…
0 Comments
• Filed in C++, Code, Programming, Tutorial
Posted on January 27, 2008
When playing a multiplayer game, setting up the game session is a formal procedure. You select your avatar, your nick and a server to play on. You’re in control of how, when and with whom you play. Its after the settings have been negotiated and everyone have clicked "ready" the actual game begins.
Now, imagine the total opposite were true. What if the actual game was setting up the game? What if the gameplay was centered around how, when and with whom you were connected?
more…
0 Comments
• Filed in Design
Posted on January 23, 2008
Last time I tried to tackle the problem with viewing source code in blog posts. If you’ve read that article, you know I settled for pastebin.
more…
0 Comments
• Filed in Programming
Posted on January 20, 2008
One thing that surprised me when starting the blog was how hard it is to do proper looking code. After all, having code on a page that indeed looks like code but doesn’t behave like code, sounds like some sort of hell. more…
1 Comments
• Filed in Blogging, Programming
Posted on January 13, 2008
I assume you know about the game Nethack, if not; read this. Some time ago a friend and I discussed if it would be possible to develop an AI/bot that played Nethack. more…
2 Comments
• Filed in AI