Skip to content

steveklabnik/maze_solver

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 

Maze Solver

Primarily, this repository is a hypermedia client for applications that serve maze+xml.

Secondarily, this repository demonstrates refactoring from a simple procedural Ruby program to an OO one.

Well, as much as 'refactoring' is without any tests, anyway.

Running

First of all, I ran this with Ruby 1.9.3. 1.9.2 should work just fine, too.

Secondly, you need some nokogiri to get going, so gem install that right-off.

Finally, just ruby solver.rb to solve the maze.

The procedural version

I started with a simple task: "request some XML with Net::HTTP" and slowly built up some code. I pulled out some methods, and before you know it, I had a little procedural maze solver.

You might be intereseted in following from the beginning. If so, check it here

You can read along with the commits to see how I built it by going here.

You can see this version here.

The Refactoring

Commit early, commit often, that's what I always say! I tried to keep the commits really tiny so you could see my process with each one. The easiest way to follow along is probably on GitHub, you can see the list of commits by going here. Check each one in order, as they build upon each other.

The OO version

After the Great Refactoring, what's left is a shiny new version with lots of objects. It happens to all of us eventually... anyway, you can check it out here.

The Alternate TDD universe

... coming soon...

About

Some experiments with Maze+XML

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages