This is not a programming language question, but a question about an algorithm. I'm making a small game and in it I need to know the shortest distance inside the maze for the object to get outside of the maze. Please see the picture attached. Here's how I was intending it to work.
Say, I need to write a function that on the input will get an object's current coordinates - for the picture example, say (3, 1) - and then the function will return a suggested next move for the shortest way out of the maze. For the example, first it should be "right", then on the next function runs it should return 5 times "down", then 2 times "right" and then 7 times "up".
It sounds like a simple thing for a human being to see, but I can't put my head around programming it.
Any help would be appreciated!
PS. If the shortest distance seems to be an issue, I'd take a suggestion for an algorithm for "any" way out of the maze.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.