This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-04-23 14:25:57

babsibraun
Scratcher
Registered: 2008-04-23
Posts: 3

Need help with a labyrinth

Hello everybody!
First of all, I'm not native english-speaker, but I try to make you understand me  smile
My computer sciences-teacher gave us the task to create a labyrinth (maze?) in which there is an object, placed anywhere in the maze, and a goal for the object. Furthermore, the user is not allowed to help the object (but you have to start it with a click on e.g. the green flag) and the object is not allowed to cross the borders of the maze. When we have finished, our teacher will change the maze so that he can see that our script works in any other maze.
Okay, that far I got along pretty well, but my object needs very long to get to the goal and it's making detours. My question is now, how can I optimize the program, so that the object doesn't make any detours and goes straight to the goal? I would be very grateful for a script that I could try.
Thank you for helping me  smile
greetings, babs

Last edited by babsibraun (2008-04-23 14:48:53)

Offline

 

#2 2008-04-23 14:38:22

SonicPops
Scratcher
Registered: 2007-06-10
Posts: 100+

Re: Need help with a labyrinth

babsibraun wrote:

Hell everybody!
First of all, I'm not native english-speaker, but I try to make you understand me  smile
My computer sciences-teacher gave us the task to create a labyrinth (maze?) in which there is an object, placed anywhere in the maze, and a goal for the object. Furthermore, the user is not allowed to help the object (but you have to start it with a click on e.g. the green flag) and the object is not allowed to cross the borders of the maze. When we have finished, our teacher will change the maze so that he can see that our script works in any other maze.
Okay, that far I got along pretty well, but my object needs very long to get to the goal and it's making detours. My question is now, how can I optimize the program, so that the object doesn't make any detours and goes straight to the goal? I would be very grateful for a script that I could try.
Thank you for helping me  smile
greetings, babs

If touching (the colour of the walls) change x/y -5?  tongue 

Not sure if it'll help.
Oh, try to greet everyone will hello, not hell  wink

regards
sonicpops


smile  Go Crank. Inc!  smile
Not much to say  wink

Offline

 

#3 2008-04-23 14:50:20

babsibraun
Scratcher
Registered: 2008-04-23
Posts: 3

Re: Need help with a labyrinth

wink  Thanks, I changed my "hell" into hello ^^ Unfortunately I cannot use the x/y-thing because it has to work for each maze you can think of...Here is my script:

<when green flag clicked>
<move( 50 )steps>
<repeat until><touching[ sprite3 ]>
<if><touching color[ black ]>
<move( -50 )steps>
<turn cw( 45 )degrees>
<move( 50 )steps>
<else>
<move( 50 )steps>

Last edited by babsibraun (2008-04-23 14:55:26)

Offline

 

#4 2008-04-23 17:23:50

N-Wear
Scratcher
Registered: 2007-08-13
Posts: 100+

Re: Need help with a labyrinth

Check out Canthiar's project at http://scratch.mit.edu/projects/Canthiar/13498


If bread crumbs are better than nothing. And nothing is better than cheese cake. Then, bread crumbs are better than cheese cake!  smile
The following sentence is true. The previous sentence is false.  hmm                              Treat others the way you want to be treated!  big_smile

Offline

 

#5 2008-04-23 18:18:52

fluffyfluflu2
Scratcher
Registered: 2008-02-17
Posts: 100+

Re: Need help with a labyrinth

there's a block<glide( 1 )secs to x sad   99)y sad  100that might help you


http://scratch.mit.edu/forums/viewtopic.php?id=5084rememberonly you can make a difference join the community today change nice effect by 100

Offline

 

#6 2008-04-23 18:19:54

fluffyfluflu2
Scratcher
Registered: 2008-02-17
Posts: 100+

Re: Need help with a labyrinth

<glide( 1 )secs to x sad  1 )y sad  1 )


http://scratch.mit.edu/forums/viewtopic.php?id=5084rememberonly you can make a difference join the community today change nice effect by 100

Offline

 

#7 2008-04-23 18:29:36

fluffyfluflu2
Scratcher
Registered: 2008-02-17
Posts: 100+

Re: Need help with a labyrinth

wink


http://scratch.mit.edu/forums/viewtopic.php?id=5084rememberonly you can make a difference join the community today change nice effect by 100

Offline

 

#8 2008-04-24 09:02:56

N-Wear
Scratcher
Registered: 2007-08-13
Posts: 100+

Re: Need help with a labyrinth

That won't work, because if you draw a new maze and change where the the goal is, the object will go to the old spot and cut lines.


If bread crumbs are better than nothing. And nothing is better than cheese cake. Then, bread crumbs are better than cheese cake!  smile
The following sentence is true. The previous sentence is false.  hmm                              Treat others the way you want to be treated!  big_smile

Offline

 

#9 2008-04-25 15:25:14

babsibraun
Scratcher
Registered: 2008-04-23
Posts: 3

Re: Need help with a labyrinth

N-Wear, that's exactly my problem...Hmm, my computer sciences-teacher wanted the program yesterday, so I gave him the one I've done. We'll see how it'll work and how the other students have solved the problem  smile  I will definitely post the solution, maybe it's interesting for you, too.
Greeting, babs

Offline

 

#10 2008-04-26 10:58:32

fluffyfluflu2
Scratcher
Registered: 2008-02-17
Posts: 100+

Re: Need help with a labyrinth

then just keep making more of them like this<glide(  1)secs to x sad  1 )y sad  1 then make another one<glide( 1 )secs to x:(202 )y sad  23 and keep make them ^^


http://scratch.mit.edu/forums/viewtopic.php?id=5084rememberonly you can make a difference join the community today change nice effect by 100

Offline

 

#11 2008-04-26 12:11:16

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: Need help with a labyrinth

The way to do it would be to have a "sensor sprite" travel the maze first, at high speed, laying down a trail with the pen tool - but when it has to retrace its steps it detects the trail it laid and erases it.  That way, when it reaches the goal there will only be a trail for the correct path through the maze.  Then your "real" sprite can follow that trail.


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

Board footer