-
Nov 29th, 2021, 05:43 PM
#1
Thread Starter
New Member
How would I complete this recursion algorithm?
I've been working on something to solve this maze I read from a .csv file. I need an algorithm that traces a path from the start point (the green square) to the end (the red one). It can do this perfectly as long as it's only ever moving in a positive direction for either X or Y. I haven't been able to figure out how to continue to trace the path if it's moving in a negative direction, and seeing as how I've only been using C# for little over a year, I could use a second set of eyes. Any help is appreciated.
Last edited by Shaggy Hiker; Nov 30th, 2021 at 11:45 AM.
Reason: Removed attachment.
-
Nov 29th, 2021, 07:12 PM
#2
Re: How would I complete this recursion algorithm?
Algorithms are language independent, so what programming languages you do or don't have experience with is irrelevant, if you really are asking for help with an algorithm. If what you're really asking for is code in a specific language then you should be writing out your algorithm first. The algorithm is just a list of steps to perform and you can devise that with just a pen and paper. You can then test that algorithm manually on a drawn maze. Once you have a working algorithm, you then write code in the desired language to implement those steps specifically. If you're having trouble, you should be able to tell us exactly what step you need help implementing. If you're just trying to go straight from the idea in your head to code, without devising an algorithm first, then that's probably why you're having trouble.
Also, if you want to show us some code, you should start by posting the relevant code directly, as text, formatted as code. Links to ZIP files that probably contain your entire project (including the compiled binaries, which is against forum rules) should be a last resort. We should have to download, extract and open something and then work out for ourselves what's relevant. You should provide only what's relevant right in your post. If we need more, we can ask for it.
-
Nov 29th, 2021, 08:01 PM
#3
Re: How would I complete this recursion algorithm?
I wrote a recursive maze solver...
http://www.scproject.biz/puzzleGames.php?appId=22
The algorithm takes the endPoint and works one cell at a time checking all four possible directions, so it branches out from the endPoint and discards any dead ends, until it finds the solution...
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Nov 30th, 2021, 11:39 AM
#4
Re: How would I complete this recursion algorithm?
Originally Posted by endlessBeggar
... I've only been using C# for little over a year, I could use a second set of eyes. Any help is appreciated.
If you are using C# you are in the wrong forum. One of the admins will move this if that is the case.
Last edited by Shaggy Hiker; Nov 30th, 2021 at 11:45 AM.
-
Nov 30th, 2021, 11:47 AM
#5
Re: How would I complete this recursion algorithm?
I removed the attachment. This forum doesn't allow posting compiled code. Please remove the bin and obj folders and re-attach. You don't need those folders anyways, as any person with VS could re-build, if they wanted to.
If you do want to do this in C#, I (or any other moderator) can move this thread there, but as JMC pointed out, the algorithm doesn't care which language you write it in. Figuring out a viable approach is language independent.
My usual boring signature: Nothing
-
Dec 8th, 2021, 04:19 AM
#6
Re: How would I complete this recursion algorithm?
As others have said, the problem you're describing is language agnostic. I would like to add that what you're describing is called a path finding algorithm. It's an area that has been studied heavily and I have no doubt someone, perhaps some academic has long figured out a standardized way of doing it. There may even be multiple methods which work better under different circumstances. I'd advise that you Google it and see what's out there and you can then apply what you find to whatever language you're writing your maze solver in.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|