View Single Post
Old May 13th, 2008, 4:55 PM   #1
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,835
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
Talking Excel As A Programming Language!?

I coded Dijkstra's Algorithm purely in Excel today! No Macros or Visual Basic either.

I did this in Data Management class out of boredom.

There is a maze that you can change by replacing the cells with 1 or nothing, and moving around "Start" and "Exit". It will calculate the shortest path to the exit by running Dijkstra's Algorithm on 7 worksheets, and displaying the path back on the original worksheet. Even though the edges are of uniform weight, I decided not to use a BFS because I figured implementing a priority queue in Excel is easier than a normal queue.

The maze is limited to 6x6 because this was just a couple hours of work. Didn't want to get too out of hand by making it dynamic.

I've zipped and attached the complete .xls file if anyone's interested. To delete a wall, click the block and hit "Delete". To add a wall, click an empty square and type "1" then "Enter". To change the Start and Exit, it should be obvious what to do. Remember it's limited to 6x6.

Below is a screenshot of it in action on two separate mazes:

Attached Files
File Type: zip Dijkstras_Algorithm.zip (106.5 KB, 8 views)
Sane is offline   Reply With Quote