Listen to Examples
- Example 1 - winning on the first try by taking all high notes.
- Example 2 - several dead ends, and backtracking once, before finding the solution.
Download Code
- ToneMaze Chuck code - you should run this code using the miniAudicle development environment.
Description
Tone Maze was written entirely in the Chuck programming language and is a musical navigation game that tests the player's ability to distinguish between different pitches. The idea is that the player will hear two droning notes at a given time, each representing a 'path' they can go down. By pressing the left and right arrow keys on their keyboard can shift their own position (represented by a tone of a different timbre) up and down by a half step until they reach one of the two desired drone notes. If they press the up arrow key while they are on one of the pitches, they will enter the next level and be presented by two more 'tone paths'.
At some point after they have traveled deep enough into the maze the player will either hit a dead end, represented by an unpleasant (and somewhat disgusting?) noise, or they will find the solution, represented by a few pitches playing in octave followed by silence. If at any time the player presses the down arrow key, they will backtrack down a level and be presented with the two previous pitch paths. If the player has navigated to an area where they are presented with two dead ends, they will need to backtrack and keep looking in different spots for the solution.
The structure of the maze takes the form of a complete binary tree, meaning that every single node of the tree leads to exactly two other nodes, unless it is a leaf node (in which case it is either a dead end or the 'solution'). The execption is that I have tacked an additional root node onto the beginning so that when the maze starts, there is only tone playing and only one path to choose from. Conveniently, the player's position pitch starts out on the correct tone to begin with. I consider this the 'warm-up' round.
Every time the maze is run, a random leaf node is chosen as the solution, and all the node pitches are randomized, except for the starting node which is always middle C. A single parameter in the code controls the 'difficulty' level, which corresponds to how deep the maze will be: difficulty 1 corresponds to 1 leaf node, difficulty 2 corresponds to 2 leaf nodes, 3 corresponds to 4 leaf nodes, and 4 corresponds to 8 leaf nodes. Difficulty levels beyond that are "not as fun" and tend to run slowly, producing audible glitches, depending on the computer. Both audio examples above are played using dificulty level 4.