User loginNavigation |
Mozart DiceSubmitted by Kenrick on Thu, 10/25/2007 - 21:18.
Oct 25 2007 - 9:18pm Etc/GMT-8 This is a simplified version of the Mozart Waltz Generator problem by David Costanzo and Kevin Wayne at Princeton University. It in turn is inspired by Mozart's Musical Dice Game. . In this version, a working program has been given to the student. All the student needs to do is to randomly generate the waltz and play it. This requires an understanding of 2D arrays, random numbers, indexing into the arrays, and iterating through the arrays. The source code is given in Java but could easily be ported to other languages that can play WAV files. Assignment: First, read the above web pages to understand how the game is played. It randomly generates a waltz in the style of Mozart out of 1.23*10^29 possibilities. Second, your task is to complete a program to play a waltz in the style of Mozart using the rules specified in the dice game. To help you, download the following zip file: MozartDice.zip. The file is massive (36 Mb) because it contains WAV files for each minuet and trio. Located in the MozartDice folder is a Java program called MozartDice.java. It initializes 2D arrays that correspond to the tables of measures, and plays a song. For example, the minuets array stores the table of minuets as shown below. Minuets Table.
The trios array is constructed in a similar manner. The MozartDice.java program plays a song always using the first entry in the array. Modify the program so that it randomly selects a minuet and trio based on a dice roll and then play the song. Comments have been added to the code to indicate what portions you should modify. Make sure your students turn in only their java program (or project) and not all of the WAV files! ( categories: )
|
tags in Keywordstags in DisciplineArchives
|