Book Review: Mazes For Programmers

Mazes For Programmers by Jamis BuckI remember first seeing this book in an newsletter from the Pragmatic Bookshelf a year ago.  It caught my attention because it seemed like a publication that was on a very niche topic yet fun.  I didn't get a copy of it when it was released because I was busy at the time with schoolwork (and then forgot about it).  Though a month ago I was down in on a weekend trip to D.C. and I saw it in a bookstore I visited; I decided to buy a copy since I have a lot more free time right now.  Being interested in game development, computer graphics, and procedural generation, I found this book to be a delight to read.

 

The Code

All of the code for each chapter (except for a POV-Ray file) is in Ruby.  My best guess why the author (Jamis Buck) chose to use Ruby is that he is a former contributor for the core team on the Rails projects.  His GitHub page is also littered with Ruby projects, so I assume it's what he's most comfortable with.

If you have zero experience in Ruby, fear not, neither did I before reading this book.  Not knowing Ruby should not be an obstacle to understand what is going on.  As long as you have a lot of experience with many different languages it shouldn't be difficult.  Most of the source reads like Pseudocode.  Only a few times did I find myself checking the Ruby documentation (e.g. Array.sample, or Ruby Blocks) to understand something unknown.  If you are looking to get familiar with the syntax of Ruby (or only to get your feet wet), I think this is a good start, but keep in mind that author's goal is not to teach you Ruby.  Personally, I would have preferred the sample code to be in Python, but that's just me.

Of the tech books I've read, I've gone through many that have given me incomplete code examples (i.e. snippets) or code that breaks on running it.  It's one of the most frustrating things out there!  Buck and the rest of the team that worked on this project did a very good job on making sure all of the code worked as it should.  I wasn't able to find a single issue with anything.  All of the code provided were complete examples.  A+

Everything builds on top of what you've done in the previous chapter, so I don't recommend skipping around.  Lots of inheritance and code reuse, which is good!

 

The Content

Weave Maze (with Kruskals's Algorithm)Most of the book's pages are dedicated to the generation of mazes in a 2D space.  In the beginning he talks about some simple algorithms like Binary Tree and Sidewinder, but later moves on to other methods that generate some more interesting maze designs.  There really isn't much of anything in the realm of solving mazes outside of discussing Dijkstra's Algorithm.  I really wish there were more included.

There was more covered than maze generation for rectangles.  I found the sections on polar, triangle and hex grids really fascinating, but the Weave grids were the best in show (to me at least).  There was also some pages for fitting mazes to odd shapes and designs.

In the later chapters Buck does show you how to generate a three dimensional maze (and talks a tad bit about 4D), but I found the representation of them to be a little difficult to follow (little red arrows are used to shift dimensions).  I would have favored something with 3D graphics instead.  That's a lot more complicated than 2D drawings and beyond the scope of this book though

One thing that was really well done was how algorithms were described with step-by-step drawings.  More books really should be doing this.  I've seen it too many times were only a single image or two are given when really seventeen should be provided  to show a run-through of an algorithm.  This made the algorithms really easy to understand without having to read any code.

3D Maze

 

 

Extra Cool Things

Something that I really appreciated is he included some code on how to display the mazes in a terminal window.  These only work for the 2D rectangular mazes (the early chapters), but I still found it nice since I love ASCII art.

At the end of the book there are two appendices that cover the maze algorithms explained.  The first one is an overview of what each algorithm does along with a picture of it.  The second one goes over some benchmarking/statistics of the various algorithms; very useful.

 

Final Thoughts

This book was worth the money I paid for it.  I don't think I'll be using anything I've learned in it immediately, but I know I will sometime down the road in my video game endeavors.  It's not a definitive source on mazes but a really good starting point.  I really would have loved some more chapters on maze solving.  One on interacting with the puzzles we generate would be cool too, but that falls more into game programming.  It has also done something for me that I've never expected; opening me up to Ruby.

It's been a while since I've read a programming book that wasn't overly dry.  Everything flowed nicely and kept me interested in learning what was coming next.  I really recommend reading this book if the subject matter sounds interesting to you.  It will be enjoyable.

 

Starting "Dart Recipes"

While I've been underway working on the C# Networking tutorial series I've been doing quite a few site updates.  It's given me a chance to add some Dart code to the site and I've decided to share some of the little playthings that I make with it.  You can find them over here.  It's not supposed to be a rational tutorial/walkthrough; nothing builds upon itself.  They are one-shot samples.  I don't plan on regularly updating it, just when I want to.

Now Mobile Friendly(-ish)
I've been working on a few C# networking tutorials for the past few weeks, but for the past two days, instead of beginning on the next one (which is about compression), I thought it would be best to spend my time fixing up the underlying HTML & CSS of this site. And in turn make my site a bit more smart device friendly

I learnt how to do web dev back in 2008. Back then you didn't have to worry about smart phones or tablets then. It was common practice to lay out your website using the <table> tag. Now that's considered bad practice. It was a little bit difficult to wrap my head on how to use <div>'s at first to accomplish the look that i wanted, but I think that it works much, MUCH better now.

I still have some CSS I need to clean up for the Tutorials sections; I'll be doing that tomorrow. I'll try to include some toggles to collapse the navigation menu in the near future.
C# Networking Tutorials

I've been hard at work to make sure that the new "Tutorials," section works well and functions the way I intended it to. Nearly every day I've been finding and fixing a new bug. Anyways, to kick it off, I will be running a series of tutorials around C#'s Networking API (the System.Net namespace). You can find it over here.

There isn't much there now, but expect more soon!

New Logo!

I've been making a lot of fixes here and there and working on some new content, but this one I've been looking forward to (and dragging my feet on): A new logo!

The first logo was actually supposed to be just a temporary logo until I could flesh out my original ideas for one.

The first one

It stayed here for 3+ years, and I grew a little attached to it. So I decided to incorporate it into the new one.

The second one

I always wanted something that was a lot more colourful. Parts of it were procedurally generated (but not much). I'd say I'm happy with it.

© 16BPP.net – Made using & love.
Back to Top of Page
This site uses cookies.