Visualizing Problem 15 of Project Euler

I’ve been working through Project Euler as a coding / math exercise. Problem 15 asks to find the amount of paths that exist between the top-left and bottom-right points of a 20×20 grid, without backtracking. I decided to visualize it, because just running a command line program and waiting can be boring.

Of course, this problem is silly to brute force, but by watching the visualization and working on a pad of paper, I came up with a much faster solution to solving the problem.

The code is available on github. It’s Ruby and Tk. Some Ruby installs don’t compile with Tk, so if the script doesn’t load the tk requirement, Google around for the solution.

Also note, this is a quick hack. It leaks memory, it’s buggy, it might eat your processor and will run for a very long time.

Leave a Reply

Your email address will not be published. Required fields are marked *