Subject: Re: find path in a labyrinth From: Erik Naggum <email@example.com> Date: 24 Aug 2002 14:08:36 +0000 Newsgroups: comp.lang.lisp Message-ID: <firstname.lastname@example.org> * "CheTeFreGa" <email@example.com> | Yes is a restriction of my Software Engineering prof.! | can you help me, Erik? Please do not quote the entire previous article when you respond. Place your text below the short relevant extractions of the quoted article, like other people whose news articles you read do. Thank you. Naïve labyrinth traversal is very simple. At every juncture, try every direction (except the one you came from) in order as long as each attempt fails, but if you have only one choice, just keep going, return failure if none of your directions yield success. Success is defined as finding an exit. This is a nice, clean, recursive function with no assignment. An alternative approach, which is not naturally recursive, is to keep left and remember where you were so you backtrack when you walk back along the same path you came. An interesting problem is how you deal with circular paths in both approaches. I assume you know whether you have them or not. -- Erik Naggum, Oslo, Norway Act from reason, and failure makes you rethink and study harder. Act from faith, and failure makes you blame someone and push harder.