Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Coder's Corner Lounge (http://www.programmingforums.org/forum11.html)
-   -   Excel As A Programming Language!? (http://www.programmingforums.org/showthread.php?t=15823)

Sane May 13th, 2008 4:55 PM

Excel As A Programming Language!?
 
1 Attachment(s)
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:

http://img297.imageshack.us/img297/5343/dijkstrany5.png

OpenLoop May 13th, 2008 5:12 PM

Re: Excel As A Programming Language!?
 
Impressive. How long did it take you to make this?

Excel can come in handy in day to day work. The actuarial department where I work uses Excel to calculate thousands of values for insurance policies. Each spreadsheet is about 30mb worth of formulas, binary solves, and a few macros to calculate the monthly premiums, cash value, interest, fees, and many other values over the life of a policy (~90 years). Luckily, I only have to look at the values and match them to the real thing on the admin system to fix values issues.

Sane May 13th, 2008 5:15 PM

Re: Excel As A Programming Language!?
 
It took me an hour during school and about an hour more when I got home.

Sane May 13th, 2008 5:49 PM

Re: Excel As A Programming Language!?
 
I found that 6x6 is too small, so I extended it to handle 12x12 and it still works lightning fast (thanks to Dijkstra).

Unfortunately, the .xls file is 11MB so I can't attach it to this post.

But here's a screen shot for what it's worth:

http://img297.imageshack.us/img297/5145/twelvehf1.png

BstrucT May 14th, 2008 1:36 AM

Re: Excel As A Programming Language!?
 
Very impressive!

Never knew one could program in Excel :-)

>BstrucT

Wizard1988 May 14th, 2008 3:33 PM

Re: Excel As A Programming Language!?
 
Awesome job Sane. Suprisingly Excel can be used for a bunch of stuff. For example you can have it render 3D objects :) http://www.gamasutra.com/view/featur...ionary_3d_.php I'm not sure how usefully doing something like this is, but it might be effective against boredom.

iEngage May 14th, 2008 5:23 PM

Re: Excel As A Programming Language!?
 
impressive!

I may try to recreate that from scratch next time I'm bored in class :P

Sane May 15th, 2008 9:47 PM

Re: Excel As A Programming Language!?
 
1 Attachment(s)
I've managed to zip and attach the 12x12.

Here's one more screenshot if you're interested to see what the tables look like.

It's simply 1 row for each iteration of the algorithm. Each iteration fills in the current state of all of the variables in 1 array. Likewise, there is 1 worksheet for each array.

http://img168.imageshack.us/img168/1...atablesks6.png

And another maze for kicks:

http://img372.imageshack.us/img372/4...strabiglx2.png

MiKuS May 15th, 2008 10:37 PM

Re: Excel As A Programming Language!?
 
yeah thats pretty cool sane, should be interesting to see if this will work in Numbers


All times are GMT -5. The time now is 4:08 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC