Assignment 1

Getting Started

Plagiarism

Note that it is not ok to exchange code or pseudo code with other students. We use plagiarism detection tools to check for similarities in the submitted assignments. Make sure that you don't leave hard copies of your code, or disks with your code on it, in the labs. For more information, read the course outline and the Yellow Form.

Updates

The updates written here are considered as part of the assignment specification.
Please check for the updates regularly and as often as possible.

Clarification

  1. Whitespaces as delimiter:
    The whitespace as delimiter means one space or more spaces, excluding new line character, EOF, and all other special characters. Thus, the user input ends with a new line character, not EOF.
  2. Dice rolling prompt:
    For (re)rolling all dice, the prompt is to be "Please enter dice values: ", and for rerolling some dice, the prompt is to be "Please enter 1 value: ", "Please enter 2 values: ", etc.
  3. Multi-digit numbers and floating-point numbers:
  4. Rerolling options:
    Even though the user is given two chance to reroll the dice, if the user chooses to keep the dice after (re)rolling, the program shoud print out the score options rather than printing out rerolling options again.
  5. Leading spaces:
    If the user types leading space(s) in front of actual input value(s), the program must ignore those space(s) and start processing the input value(s)
  6. Negative numbers:

Typo Correction

Testing

You can find the test files from http://www.cse.unsw.edu.au/~cs1917/16s2/ass/1/testfiles.tar.gz,
and the sample output from http://www.cse.unsw.edu.au/~cs1917/16s2/ass/1/output.tar.gz

In order to test your solution with the given testfiles, you must go into your assignment directory, and uncompress the packages using:

tar -zxf testfiles.tar.gz
tar -zxf output.tar.gz

After uncompressing them, you will see two directories: testfiles and output. There are 70 test files in testfiles directory.

By running

./assign1 < testfiles/FILENAME > result
diff -iEBbw output/FILENAME_output result

you can check if your program passes each test. FILENAME has to be the actual filename such as 70stage2_chance and 18stage1_fourofakind, and FILENAME_output has to be the actual filename found in output directory such as 70stage2_chance_output and 18stage1_fourofakind_output. If the diff command shows you nothing after the run, it means that your program has no problem with the test case.

Again, if nothing is displayed after running these commands, your program has passed all the test cases provided.

Sample Solution

You can download the binary of the sample solution for the assignment from here.
After downloading the file, you should run

chmod a+x assign1_sample

to make it executable.