Please make sure you are familiar with the resources and policies outlined in the syllabus and the take-home assessments page.

A2 - Guitar Hero

Due by Thursday 01/20 at 11:59 pm.

No submissions accepted after Sunday 01/23 at 11:59 pm.

Specification Intro Video Submit Code on Ed

You may submit any part of the assignment as many times as you want before the due date. To submit on EdStem, you should use the Mark button to submit your code. You can view your past submissions using the “Submissions” button.

Code Files

Main files:

GuitarString testing files

Guitar37 testing files

  • test37.zip (files to test Guitar37; include your Guitar37 class and compile and run Test37, check against output comparison tool)

Playing files (extra)

All files

  • a2.zip (contains all supporting files)

Developing at Home

You are welcome to use Ed as your environment to work on the homework, but we recommend setting up a local environment following our Desktop Software instructions. This will allow you to work offline, and access the great debugger provided by jGrasp! You can download the code from Ed and when you want to submit, upload it again and then pressing Mark to submit.

Test37

For this assessment, we provide some testing code in the form of the test37 folder. To run this, you need to copy just your Guitar37.java into this directory and run there (do not copy GuitarString.java). Note the way we test your Guitar37.java in this folder is to use a custom implementation of GuitarString.java to control the behavior of the generated numbers. So if you are running the test locally, you need to just copy the Guitar37.java into this folder and run Test37.java.

If you upload your code to Ed, you can also use the Check button to run the Test37 files without needing to copy code into directories. It will print output to the terminal which you can copy to the output comparison tool.

Frequently Asked Questions (FAQ)

Q: I have no idea how any of this sound stuff works, how can I even start this assignment?

A: You do not need to understand the physics of sound in order to do this assignment! You should start with GuitarString and try to implement that completely before starting on Guitar37. While the reason GuitarString works based on physics of sound, you don’t need to actually understand it. In the GuitarString section of the spec, it exactly describes how to implement the code, which you should follow to get a working implementation.

Q: How do I run test 37?

A: Copy your Guitar37 into the test37 folder and run Test37.java from there. You should not modify or use the other files from the test directory since they are all testing related.

Warning: You should be careful when copying your homework files. Now you will have two files on your computer called Guitar37 and you want to make sure you are editting the right one (outside of test37) when you are making fixes to your code.

Q: How do I generate a random number?

A: You should use a Random object or Math.random(). If you are not familiar with generating random numbers, please review the textbook.

Q: Can I assume the client knows what the ring buffer is?

A: This is answered in the spec. A helpful paragraph might be:

It is difficult in commenting the GuitarString class to know what constitutes an implementation detail and what is okay to discuss in client comments. Assume that a client of the GuitarString class is familiar with the concept of a ring buffer. The fact that we are implementing it as a queue is an implementation detail. So don’t mention how you implement the ring buffer. But you can discuss the ring buffer itself and the changes that your methods make to the state of the ring buffer (e.g., moving values from the front to the back of the ring buffer). You may also assume that the client is familiar with the Karplus-Strong algorithm