indeed

Pathfinder: Ruby & The A* Algorithm

Please note, this series of posts is currently under development, as is the code to accompany them. If you have any questions or suggestions, please email them to watts[at]nathanielwatts.com

I played a lot of video games growing up.

From the original 8-bit Sega Genesis to the more modern solutions of only few years ago, I battled both the latest puzzles and bad guys – while simultaneously battling my own addiction. I’m thankful to say that in these recent years I’ve gained some self control (to the joy of my wife).

However, I can still remember many sleepless nights where I would oh so quietly sneak downstairs in hopes to conquer the next quest on Diablo 2… covering our old Pentium III machine with a thick blanket so that the dial up modem wouldn’t wake my sleeping parents.

At the time I didn’t program. I certainly wanted to – but to me programming was moreso the things that you saw on television (you know, where some elite young kid was typing 200 words per minute sans typos or spacebar usage).

Looking back now, as someone with more programming experience, it’s incredible to think of the amount of work that went into even the simplest of games.

The Challenge

As this school season is coming to a close – we’ve been encouraged to work on problems that are more difficult than hard. Problems that won’t help us build a website or create the next big widget – but problems that are a genuine challenge to solve.

To support us in that challenge our lead instructor, Jeff Casimir, posted up some data structures and algorithms problems for us to take a shot at.

Here’s where the videogames come in.

Among the listings of challenges was one called The A* Search Algorithm.

It’s algorithms such as A* that made possible my many many hours spent in my college dorm playing Starcraft.

But what does it do? In a really small nutshell – it can be used to calculate the path your character should travel when you’re at point A and you want to go to point B – and there’s junk in the way.

The Goal

I want to document my process of reproducing this algorithm with Ruby in a series of blog posts.

My solutions likely won’t be perfect, but I’m not concerned about perfection right now – I just want to make the thing work. Once that’s delivered, we can evaluate and refactor. But you can’t do the latter without the former.

Why Ruby? – Because that’s what I’ve been learning for the past four and a half months at a place called gSchool, and I like it.

Tests? – You betcha.

So what now?

Stay tuned for the next post! I’ll be going more in depth about the A* search algorithm as a whole, and then we’ll jump into the code!

Tagged under A*

Hello World?

First post.

My hopes: reflect on life, experiences, and add some value to the development community.

Sidenote – I have quite a few older blog posts from the past 4 months. I’ll be retroactively adding them as time passes. This post, however, is my MVP.