[an error occurred while processing this directive]

Programming Assignment Checklist: Hamming Codes

Frequently Asked Questions

What are the goals of this assignment? To Learn about error-correcting codes and get more experience programming in machine language.

I can't launch the Java Web Start version of the Visual X-TOY simulator. Any ideas? Check the piazza thread on getting X-Toy to work. The have been a range of problems on both Mac OS and Windows this semester related to recent Java security bugs.

How do I format the TOY output? You can't. Just print one integer per line (0000 or 0001).

My program prints out the right answer, but then I get java.lang.NumberFormatException: null. What could be wrong? You are probably trying to read from standard input, even though it is empty. Be sure that your TOY program terminates when it encounters FFFF.

How do I write/comment a .toy file? To initialize a location in memory to have a value, write (on its own line) the index of the memory location (two hex digits), followed by a colon, followed by a space, followed by the value (four hex digits). Anything else on the line is ignored by the TOY simulator and treated as a comment.

TOY.java doesn't read in some of my instructions. Any ideas? Be sure that you follow the required format XX: XXXX. Check for duplicated line numbers and using the letter O instead of the number 0.

How much do I need to comment my TOY code? At a minimum, you should:

Developing a TOY Program

To simulate the execution of your program on a TOY machine, use either the bare-bones TOY.java or the full-blown Visual X-TOY simulator. To get started, download the sample TOY program multiply.toy.
Input, Output, and Testing

Input. Download data.zip and unzip it into the same folder as you encode.toy and decode.toy programs.

Execution.  To redirect standard input from a file, execute your programs with:

% more encode1.txt 
Terminal
---------------------------------------
0001 0001 0000 0001 
FFFF

% java TOY encode.toy < encode1.txt
...
Terminal
---------------------------------------
0001
0001
0000
0001
0001
0000
0000
...

% more decode1.toy
0001 0000 0000 0001 0001 0000 0000
FFFF

% java TOY decode.toy < decode1.txt
...
0001
0001
0000
0001
...

Testing.  The most complete way to test your TOY programs is to encode and decode all possible inputs. All the files referenced below are also in the data.zip archive.

Reference solutions.   As a special bonus, we provide Java source code HammingEncoder.java and HammingDecoder.java for the two programs. You are welcome to examine this code and use it to develop your TOY programs.

Debugging Tips

Here are some debugging hints that may help you out.

Enrichment