Wednesday, May 25, 2005

Maze - finding out the way

I am sure each one of us as children would have enjoyed solving maze problems which entitled helping some animal (usually it is a rabbit, which is horribly hungry!) at the 'start' to reach food at the 'end' of the maze. In its simplest form it can be representation like this:

(Imagine that the blue circle is the hungry rabbit and the green square food)

During my college days I had written a program to achieve this. There are various ways by which you can solve this problem. Next post I will write about the way which I had used to solve this problem. Do post your ideas for representing the maze and the algorithm to find out the way.

10 Comments:

At 12:02 PM, Blogger Gops said...

How about a matrix, and using recursion?

 
At 10:30 PM, Blogger Balbir Singh said...

Well, I have never solved this problem in practice, but I think in theory one could use backtracking. Which is what gops has suggested as recursion.

We can simply the problem further by saying that given a matrix of 1s and 0s, where 0s represent possible paths, 1s represent a baracade and 2s represent visited paths, can we find the path to the food?

I would vote for backtracking!

 
At 6:16 AM, Anonymous Anonymous said...

酒店經紀 酒店打工 酒店工作 酒店上班

 
At 6:16 AM, Anonymous Anonymous said...

酒店經紀 酒店打工 酒店工作 酒店上班

 
At 6:16 AM, Anonymous Anonymous said...

酒店經紀 酒店打工 酒店工作 酒店上班

 
At 6:16 AM, Anonymous Anonymous said...

酒店經紀 酒店打工 酒店工作 酒店上班

 
At 6:17 AM, Anonymous Anonymous said...

酒店 台北酒店 酒店兼差 酒店兼職

 
At 6:17 AM, Anonymous Anonymous said...

酒店兼職 酒店 台北酒店 酒店兼差

 
At 6:17 AM, Anonymous Anonymous said...

酒店兼差 酒店兼職 酒店 台北酒店

 
At 6:17 AM, Anonymous Anonymous said...

台北酒店 酒店兼差 酒店兼職 酒店

 

Post a Comment

<< Home