Blog posts tagged "programming"

Back in 2009, I made a little game called Maze Of Life. In each level, you are placed into a randomly generated maze, and you have to make your way to the centre. The goal is to complete as many levels as possible without getting stuck.

The natural question here would be -- how do you get stuck in a maze? Therein lies the twist with this game. The mazes are generated using a cellular automata similar to Conway's Game of Life, and the rules of the automata continue to apply while you are playing the level. This means that the walls of the maze can shift around you when you walk by them. Every level begins in a completable state, but you can make it incompletable based on your actions. You can get pretty far using skill -- there are patterns to the shifts in the maze that you can pick up on -- but sometimes? Sometimes your luck just runs out.

To make a long story short, despite this game being written in C++, it is now available to play within your browser:

And now I'm going to talk about it, because I have a tooth infection and I'm too dizzy to play video games.

Read more...
Hatkirby on November 4th, 2023 at 4:03:03pm
πŸ‘ 1 πŸ‘Ž

TLDR: Going forward, I will be hosting most of my code on code.fourisland.com instead of Github.

At some point in the last decade, Github took over the world of open source development.

I can't really remember when it happened. Before then, I would maintain my source repositories on my own server. I used CVS at first, before switching to Subversion, then Git, and then Mercurial. I stuck with Mercurial through most of high school, if I recall correctly, although now that I've become an avid Git user (perhaps something forced onto me in college?), I'm not sure what it was that I liked about Mercurial over Git. The point is that throughout that time, I just had source repos on my server, and I'd clone them on whatever computer I was doing development on. It was fine.

One of the earliest times I can remember using Github was to host the code for Rawr eBooks. It was adapted from a class assignment in my second year of college, so that timeline seems to fit the narrative that school got me into using Git. It was around that time that I also moved away from maintaining my own infrastructure as much. I was no longer using my personal website, Four Island (yes, the one you're on right now! it's complicated). I also was not working on the kind of projects I had worked on in high school anymore.

Read more...
Hatkirby on October 13th, 2023 at 3:12:57pm
πŸ‘ 1 πŸ‘Ž

I've made some changes to my Twitter bots recently regarding how they choose the words that they post. This was in response to a situation wherein a follower notified me that @blessthisdoobie posted a tweet containing the n word. In this post, I'd like to discuss 1) how this happened, and 2) what I've done to prevent it from happening again. However, I first and foremost want to apologize to the followers of the bot. I take it very seriously when my bots post offensive content, and I want to do what I can to ensure that my bots remain safe and fun for all.

Now, I'd like to explain how this happened in the first place. A large number of my bots use a library I created called verbly for natural language processing. This includes @blessthisdoobie, which uses verbly to find nouns and verbs that rhyme. verbly is a complex library, and the reason behind this issue requires some knowledge of how verbly works. I will provide a brief description of the relevant parts of the library, and if it sounds interesting, I wrote a motivating example for the data model that you can read later.

Read more...
Hatkirby on August 14th, 2018 at 9:23:16pm
πŸ‘ 2 πŸ‘Ž

During my leave from school, I've been funneling my creativity and recuperative free time into making a autobiographical game. I've tweeted about it quite a bit in the last month. Progress has been slow, due to the illness that I'm recovering from, but the progress made so far has been both fun and illuminating. I'm using C++ for this project, of course not for the first time, but still, using C++ always results in you learning something strange about the language that you probably didn't want to know.

One of the things I've been implementing for my game engine has been an entity-component system. In short, such a system consists of two fundamental objects: entities, and components. Entities are perfectly generic objects that have no properties besides being able to contain components. Components are specialized objects that provide specific functionality to their parent entities. Such a system allows one to decouple a lot of the inner workings of a game engine as well as provide a simple way to mix and match functionality.

So, to start implementing this system, I created an Entity class and a Component class. I wanted Entity to be able to contain Components, but I didn't want to have to go through the trouble of writing my own linked list implementation, so I used one of the STL containers, list, which provides the exact functionality I am expecting. Well, almost the exact functionality, but we'll get to that later. Component was implemented as a class with several virtual methods that could be overridden by subclasses to provide their specialized funtionalities.

Read more...
Hatkirby on March 4th, 2015 at 12:00:00am
πŸ‘ 1 πŸ‘Ž

Working on rawr-ebooks recently has allowed me to tinker with the writhing mass of horror and love that is C++. You may not be able to tell from this that I am a massive fan of C++. The nitty gritty, say what you mean and EVERTHING you mean fifty times methodology of C++ is actually a great amount of fun for me, and what would be better than implementing a fun algorithm in a really fun, rigorious programming language?

One of the incredibly fun parts about C++ is that it's practically a well of undefined behavior. If you aren't doing things exactly right, there's really no telling what will happen. And how do we define "exactly right"? Well, we're not always completely sure about that. Here's an instance of that.

As you may know, there are two real ways to allocate memory for a struct in C++. One is to use malloc or calloc, pass it the sizeof your struct, and then cast the resulting pointer to a pointer of your struct. The other, fancier and C++-exclusive method is the use the new operator. While this is all fine and dandy, it turns out that these methods are not exactly equivalent. I'd like you to examine the following two blocks of code and tell me what they output, okay? Let's have some fun.

Read more...
Hatkirby on October 6th, 2013 at 1:00:00am
πŸ‘ 1 πŸ‘Ž

Ok. Recently, I (OMG, I didn't mean to!) attempted to help an acquatience activate their copy of Windows XP, which was expiring in a day. Their computer was really old, and it had a copy of Xubuntu Gutsy on it, but they preferred Windows XP for some strange reason.

So, I though, this'll take five seconds. Oh, but I forgot to mention, their computer didn't have internet access. Oh well. At least there's an automated phone service used to handle Windows activations (toll-free!).

So I called the number for my region and waited. It asked me a few questions like "Are you activating Windows XP?", but it wanted me to say yes or no. Confused, I answered, but the next part was the GAH.

The computer at the other end told me to recite the Windows XP activation code to her. This is a some 32 digit long number and I have to TELL her it instead of just typing in the numbers on the phone.

Warning: If you're ever trying to do this, get someone to do it who has no emotions. I giggled after the first block of numbers and the computer said: "I did not understand that. Good bye."

Oh, and by the way, it turned out that they had an expired version of Windows XP anyway, so the time I spent was futile. Oh well, at least it was funny. :)

Hatkirby on December 5th, 2008 at 4:10:12pm
πŸ‘ 1 πŸ‘Ž