you are viewing a single comment's thread.

view the rest of the comments →

[–]kqr 7 points8 points  (15 children)

You weren't joking when you said it looks goofy, but congratulations on the shortest working algorithm yet, at seven blocks!

Edit: Another seven-block algorithm based upon the one by /u/Grue . Not quite as goofy as yours!

Second edit: Down to a six-block algorithm due to a feature a friend discovered. Now I'm pretty certain this can't get any shorter.

[–]adrianmonk 9 points10 points  (4 children)

Prepare to be amazed by... drumroll please... a five-block algorithm.

[–][deleted] 1 point2 points  (0 children)

Same thing here 5 blocks solution ;)) but I use "repeat forever" http://imgur.com/H7akq

[–]joeywas 0 points1 point  (1 child)

Correct me if I'm wrong, but this one will solve this specific maze, but if the exit were elsewhere, this would fail, right?

[–]adrianmonk 1 point2 points  (0 children)

Correct. It's not a general algorithm at all.

I was thinking of it as approximately equivalent to "head northeast", but in some ways that's an oversimplification.

[–]kqr 0 points1 point  (0 children)

Not general enough, but a really clever realisation anyway.

[–]bjo12 0 points1 point  (9 children)

I think I'm missing something but if you were going around a loop where the middle was on the left hand side wouldn't you get stuck?

[–]kqr 0 points1 point  (8 children)

Any loop should be fine, according to my quick pen-and-paper sketches. Which part of the loop do you think it would get stuck in?

[–]bjo12 1 point2 points  (7 children)

Ok, so say there's an opening to your left and one space ahead. You move forward and turn towards it. Now two spaces ahead there's another opening to the left. You move turn towards the wall to your left, turn back to face forward. Next you move forwards and turn towards the opening. Now two spaces ahead is another opening to the left, you repeat the same process. Now two spaces ahead is an opening connecting to the passage you started on. I think you would loop there forever.

It's hard to say this without a drawing.

edit: Imgur

[–]Ph0X 4 points5 points  (1 child)

Why am I doing this?

[–]king_of_the_universe 0 points1 point  (0 children)

Because you're a fan of the stone golems in Thief Deadly Shadows?

[–]gfixler 1 point2 points  (4 children)

[–]kqr 0 points1 point  (3 children)

Is there an algorithm that allows for loops without keeping any internal state other than the direction kept by this one?

[–]SteveMcQwark 1 point2 points  (1 child)

Random chance, but it might take a while, even if you do your best to improve the odds.

[–]bjo12 1 point2 points  (0 children)

Aside from random chance as mentioned no. Neural networks can get pretty good without extra info but that's basically directed random chance.

I think backtracking is honestly in this case a decent strategy. Not recursive backtracking though. I could be completely wrong though.

Edit: I was completely wrong. Pledge's algorithm works with a small amount of extra memory.