2010 | OriginalPaper | Chapter
Mazes
Activate our intelligent search to find suitable subject content or patents.
Select sections of text to find matching patents with Artificial Intelligence. powered by
Select sections of text to find additional relevant content using AI-assisted search. powered by
In this chapter, you learned how to implement a program to support the building of a maze of walls and to store it on the local computer. You also learned how to create a maze travel game. We used the following programming techniques and HTML5 features:
programmer-defined objects
capturing key strokes; that is, setting up event handling for key presses, and deciphering which key was pressed
localStorage for saving the layout of the walls of the maze on the player’s computer
try and catch to check if certain coding is acceptable
the join method for arrays and the split method for strings
mouse events
mathematical calculations for determining collisions between the token and the walls of the maze
radio buttons to present a choice to the player.
The use of local storage was fairly intricate for this application, requiring the encoding and decoding of the maze information. A simpler use might be for storing the highest score or the current score on any game. You can go back to previous chapters and see if you can incorporate this feature. Remember that localStorage is tied to the browser. In the next chapter, you will learn how to implement the rock-paper-scissors game, and how to incorporate audio in your application.