renciso218 / blockly

Automatically exported from code.google.com/p/blockly
0 stars 0 forks source link

change the ways of the maze #8

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
How change the ways of the maze?
In the Future?

Original issue reported on code.google.com by Lestat...@gmail.com on 3 Jun 2012 at 10:51

GoogleCodeExporter commented 8 years ago
I know it's just a Blockly demo, but a random maze really would be nice for 
testing solutions. As the maze is predictable, the fastest-to-execute solution 
is FWD FWD LFT FWD .. etc

Original comment by RickMeas...@gmail.com on 4 Jun 2012 at 12:00

GoogleCodeExporter commented 8 years ago
Shouldn't there be a "finish" block to control when to stop the program?
I could try to solve the problem by always turning to the right or always 
turning to the left (for example), but without a way to tell it to stop, it 
could be crawling the maze forever.

Original comment by damianv...@gmail.com on 4 Jun 2012 at 2:19

GoogleCodeExporter commented 8 years ago
Do you mean a way to arbitrarily stop, or to finish when you reach the 
destination? In my experience, it does finish when the player hits the 
destination, so there is no need for a finish command. I also don't see a need 
for a finish at an arbitrary time, since you can just hit the "Reset" button 
manually.

Original comment by matt.gi...@gmail.com on 10 Jun 2012 at 3:53

GoogleCodeExporter commented 8 years ago
Ideally, at least for teaching purposes, blockly would have a demo of how to 
create a new maze so that students could challenge each other on creating mazes 
that could then be saved, shared and then solved by other users.

Original comment by dennisgd...@gmail.com on 11 Jun 2012 at 10:31

GoogleCodeExporter commented 8 years ago
The "finish" should be in the form of the repeat until block with an "is at 
exit" (or similar) condition.

Original comment by conceptg...@gmail.com on 12 Jun 2012 at 8:39

GoogleCodeExporter commented 8 years ago
Yes, random maze generation would be a really nice feature!

anyway, this project is awesome! I'm really looking forward to write an 
integration for drupal with this! Thanks so much for this

Original comment by padddy...@gmail.com on 13 Jun 2012 at 10:41

GoogleCodeExporter commented 8 years ago
Changing the maze is not hard; random would be more difficult. To change the 
maze you edit the matrix in maze.js. The code is all well commented. Unless you 
want to run the maze 'blind', you must also change the map.png graphic to match 
the new matrix, which is just a single image. 

So to create a random (and correct -- there are a certain rules you must follow 
in the matrix to make it solvable) matrix WITH a matching generated image 
behind: that's a hard task.

I created a few diferent mazes that I am attaching here. Note that I made the 
matrix size bigger in most cases. All the outside matrix elements MUST be 
blocks, so the actual size of what you have to work with in building a NxN 
matrix is really (N-1 x N-1). So for the original matrix size of 8x8, there are 
a finite number of buildable mazes and that number is (I am guessing) 
surprising small. (Anyone care to calculate that?)

For the mazes attached here, I have a single fairly elegant/compact solution 
which will solve all, except "bigger3". I'm not attaching the solution!

For opening the attached mazes, in every case, point your browser to the 
"index.html" file. I'm using Safari, and the right-hand frame is visually 
messed up, but functional. If someone with better html/javascript gets a chance 
to improve that, please share!

You'll see that I didn't put a ton of work into the background map.png image 
either!

The matrix size can be even larger of course. For every increment of 2 (i.e., 
as I increased the matrix size from 8x8 to 10x10) the map.png size increases by 
100px. You also need to edit the container size in index.html. So the original 
size is 400 x 400, and in my 'bigger' mazes it is 500 x 500. 

cheers to all, waldo

Original comment by waldo.wi...@gmail.com on 14 Jun 2012 at 5:27

Attachments:

GoogleCodeExporter commented 8 years ago
in firefox the right frame doesnt work.
is there any fix?

Original comment by Kuche...@googlemail.com on 15 Jun 2012 at 10:06

GoogleCodeExporter commented 8 years ago
The new "Randomize" button moves the start and end points, as well a the 
starting direction.  There are now 80 different permutations (5 * 4 * 4).  
Enjoy!

Original comment by neil.fra...@gmail.com on 9 Jul 2012 at 6:29