Graph Traversalby lhoward (Vicar)
|on Nov 08, 2000 at 22:16 UTC
lhoward has asked for the wisdom of the Perl Monks concerning the following question:
This is more of a general computer science/graph traversal question than a perl question; but I'm coding in perl and I know that this is a very smart crowd so I thought I'd see what help you could offer.
I've recently started playing the online game CashWars (note: this post is not a troll to get people to play CashWars, but if you do want to try it out, use the following link CashWars and I will get some nominal credit for refering you).
The game is played on a 721x721 grid. Every day you get so many moves (I'm currently at 350 per day, but you can have as many as 600). Moving 1 square horizontally or vertically costs 1 movement point. Certain squares contain resources (Oil) that you can gather. You can only gather resources from a particular square once per day. I have a large list of the squares that contain oil. What I am trying to do is compute an "optimal or near optimal path" to visit as many oil squares as possible in a given number of moves from a particular starting location.
I've already tried out a few algorithms:
I can post my code for any of those algorithms I've tried already if anyone is interested.