DT2 Posted June 14, 2012 Posted June 14, 2012 Blockly Demo: Maze Be interesting to see people's code once they've done it too. DT 2
sonofsanta Posted June 14, 2012 Posted June 14, 2012 You git... I have stuff to do today but I am determined to solve this in an elegant way. I will be back shortly.
TechMonkey Posted June 14, 2012 Posted June 14, 2012 Grrr, the loop keeps catching me. I can make it so I avoid it but only by pre-knowledge of the T-junction so default to the correct direction.
JJonas Posted June 14, 2012 Posted June 14, 2012 done it will all purple statements, not elegant but it works
Pyroman Posted June 14, 2012 Posted June 14, 2012 i get to the flag and he does a little shake and then nothing?
teejay Posted June 14, 2012 Posted June 14, 2012 Solved with one repeat forever loop and one if then else. Toms thing about turning left is an important clue:p
Devontechie Posted June 14, 2012 Posted June 14, 2012 i get to the flag and he does a little shake and then nothing? Yeah I get the same!
tom_newton Posted June 14, 2012 Posted June 14, 2012 i get to the flag and he does a little shake and then nothing? That's the idea - you win
Pyroman Posted June 14, 2012 Posted June 14, 2012 That's the idea - you win Ah cool, i just expected it to move to another level.
sparkeh Posted June 14, 2012 Posted June 14, 2012 Solved with one repeat forever loop and one if then else. Toms thing about turning left is an important clue:p Same here, awesome little diversion
sparkeh Posted June 14, 2012 Posted June 14, 2012 http://www.cuckoosegg.com/maze.png *SPOILER* Slightly different solution for me: https://docs.google.com/open?id=0B8CqsOJQhM-Ed0pSNzV3UVpucDA 3
tom_newton Posted June 14, 2012 Posted June 14, 2012 Slightly different solution for me: https://docs.google.com/open?id=0B8CqsOJQhM-Ed0pSNzV3UVpucDA Does that work if you change left for right in both cases?
sonofsanta Posted June 14, 2012 Posted June 14, 2012 Slightly different solution for me: https://docs.google.com/open?id=0B8CqsOJQhM-Ed0pSNzV3UVpucDA Oh for... didn't know you could change the "wall ahead" to "wall on the left", I kept having my bloke turn left to check 1
mac_shinobi Posted June 14, 2012 Posted June 14, 2012 *** SPOILER ***** This is how I did it , more then likely a messy way of doing it but it seemed to work Repeat While Not wall ahead Do Move Forward + If not wall to the right then turn right turn right + if not wall to the left then turn left Move Forward Tried to upload a screen grab but wouldn't let me
mac_shinobi Posted June 14, 2012 Posted June 14, 2012 (edited) Slightly different solution for me: https://docs.google.com/open?id=0B8CqsOJQhM-Ed0pSNzV3UVpucDA That's a lot more elegant than my solution - sigh * grumble grumble * I couldn't get your solution to work but I did get the Else bit ( clicking the plus symbol ) DOH Edited June 14, 2012 by mac_shinobi
tom_newton Posted June 14, 2012 Posted June 14, 2012 Oh for... didn't know you could change the "wall ahead" to "wall on the left", I kept having my bloke turn left to check Yeah, @OB1 did that 1
sonofsanta Posted June 14, 2012 Posted June 14, 2012 (edited) Done it now, so much easier when you know all the commands available to you... *grumble* Which is pretty much the same as Tom's, but with the evil of a nested if. sparkeh's looks neatest so far, I reckons. And no I have not just been doing this all morning although I am clearly out of practice at my algorithms. Edited June 14, 2012 by sonofsanta split subject/verb! the horror
apeo Posted June 14, 2012 Posted June 14, 2012 Heres how i did it: Repeat forever --if not wall ahead ----move forward ----turn left --else ----turn right --end if end do I didnt know you can change the wall ahead LOL 1
DT2 Posted June 14, 2012 Author Posted June 14, 2012 Here's mine... little different but it works.... 1
TechMonkey Posted June 14, 2012 Posted June 14, 2012 My issue was I could make a script so he got to the end but hypothetically if the map was reversed he would get caught in the loop. So would these answers still work if you were given a mystery map, especially if you think about the island problem with wall following. Or am I over thinking the problem as usual?
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now