213 posts
Location
the Nether(lands)
Posted 28 May 2012 - 01:55 PM
I made a maze solver program for turtles, I'm still working on it but here's a video demonstrating the current version:
[media]
http://www.youtube.com/watch?v=r5DVmVwKZOs&feature=plcp[/media]
65 posts
Location
The Internet
Posted 28 May 2012 - 03:29 PM
Looks good. I've yet to mess with turtles a lot, but it seems like you know what you're doing. Good job :)/>/>
992 posts
Posted 28 May 2012 - 07:21 PM
while the turtle does finish the maze it explores every possibility before doing this.At first i thought you were using the always turn left method of solving a maze but I don't understand how your maze solving system works. I don't know why you make the turtle spin twice thought ounce should be enough to detect all sides. There could be some optimization made to your code. for example checking for walls is not required on a block where the turtle has been before.
possible improvements
- The turtle only spins ounce after a move.
- A turtle doesn't check for walls when moving along a known path (path the turtle has been down before)
I wonder if this system could be used to make a turtle navigate a cave seeing as a cave is basically a maze. this makes me want to design a 3D glass maze and apply your algorithm in it. Will you be releasing the code for this?
213 posts
Location
the Nether(lands)
Posted 28 May 2012 - 07:31 PM
while the turtle does finish the maze it explores every possibility before doing this.At first i thought you were using the always turn left method of solving a maze but I don't understand how your maze solving system works. I don't know why you make the turtle spin twice thought ounce should be enough to detect all sides. There could be some optimization made to your code. for example checking for walls is not required on a block where the turtle has been before.
possible improvements
- The turtle only spins ounce after a move.
- A turtle doesn't check for walls when moving along a known path (path the turtle has been down before)
I wonder if this system could be used to make a turtle navigate a cave seeing as a cave is basically a maze. this makes m
e want to design a 3D glass maze and apply your algorithm in it. Will you be releasing the code for this?
I'm using Trémaux's algoritme. The small maze in the video is a bad demonstration, but if you have a giant maze it look much smarter.
As for you tips:
1. It spins twice because it has to look arround first and then it has to turn in the right direction, It does turn too much sometimes, so I could improve that.
2. That's a very good Idea I will try to implement this when I have time.
3D is half implemented. It would make it much slower though.
It isn't made for cave exploration. Even if I added 3D it would take ages to explore the cave. Altough I might make another program for exploring caves, since that seems like a very fun challenge
992 posts
Posted 28 May 2012 - 08:17 PM
this is a script that can move a turtle to a specified direction. is is set up in a test program that can simulate all movement possibilities. you can use this script or any part of it in your code I am releasing this under no license and I do not want credit for it.
the left function and the right function do not move the turtle as i was bench testing this on a computer. you will need to adjust these to work with your movement functions.
http://pastebin.com/hmy2TuZ8the movement function could be changed to something like this.(un-tested)
function right()
if turtle.turnRight() then
face = face+1
if face > 4 then face = 1 end
return true
else
return false
end
end
213 posts
Location
the Nether(lands)
Posted 28 May 2012 - 08:57 PM
this is a script that can move a turtle to a specified direction. is is set up in a test program that can simulate all movement possibilities. you can use this script or any part of it in your code I am releasing this under no license and I do not want credit for it.
the left function and the right function do not move the turtle as i was bench testing this on a computer. you will need to adjust these to work with your movement functions.
http://pastebin.com/hmy2TuZ8the movement function could be changed to something like this.(un-tested)
function right()
if turtle.turnRight() then
face = face+1
if face > 4 then face = 1 end
return true
else
return false
end
end
Thanks. I will look at it tomorrow. I did make a little update so it doesn't have to scan as often, so it's a bit faster now.