Go Down

Topic: LOL shield maze game (Read 1 time) previous topic - next topic

marijn

Here ia a nice game made for the LOL shield. It is part of a project to stimulate kids to play around with electronics and arduino. The rest of the project will be post on my blog:www.jelbert.nl as soon as it is ready.
It creates a maze (can be very large like 75x50). Then displays the part that will fit on the shield for 5 seconds and then let you walk the maze with only your field of view.
It uses an arduino mega 1280.

Ok the code is too much for this forum. In that case you can find it here http://www.jelbert.nl/?p=429

sbright33

I clicked your link but I didn't have much time to study the code yet.  How does it make a maze with only one possible solution?  Will it always be difficult, or sometimes trivial to solve?  Do you have to generate the maze manually? 
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

marijn

The maze is created in a boolean array.
The array is first filled with walls '0'.
Then starting at 0,0 a routine walks at ranom through the maze.
It only walks here were no walkway are already and will not connect walk ways.
Then when in reaches an end and can go no further the routine starts again at 0,1 and tries to find a place from the walkway where the walkway can go without connecting roads.
This will create a maze with only one solution.

If the maze becomes huge like 50x50 or bigger, there are places in the maze where walkways still could be made and are not filled up. Solving a maze like that with only a viewport of 12 steps max. and rembering where you have been is not very likely so I did not solve that part yet.

Then in the end I have a routine scanning the 4x4 squeares in the lower right corner for walkway. The one closest to the higest coordinate (19,19) will be set as the exit of the maze. Once you reach that point the game will restart.

The game is mostly difficult to solve even if you know how it has been programmed.

Enhancements I want to make are playing a tune and an animation at the end of the game and increase level by making the maze bigger.

To make maze bigger the array will need to be bigger. But if the game is going to be part of a toolset for kids to play with (including the games that come with the lib) it could be handy to be able to release the memory occupied by the array. Is there a way to do that within the arduino?

sbright33

Wonderful code!  I haven't tested it yet but I'm impressed.  I was obsessed with mazes when I was 8 for years.  I'd stick a fork in you if I could.  Well done.
If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

marijn

Thanks! 8)
The code on my blog is displayed funny, or not realy funny since half is missing.
I included the maze.ino in this post so people willnot have to cut and paste funny code.

Go Up