DO NOT try this until you have finished all regular parts of this lab (Parts 1-3). Extra Challenge parts are just a way to try something with an added challenge for fun. We will award a nominal amount of extra credit points to your lab score for successful completion of these (and it is all or nothing grading), but they will really have no impact on your lab score: it is much better to finish the required parts completely and to finish them well, than to try the extra challenge and not submit complete required parts.
You only will receive a few extra lab points if you get all parts of the Extra Challange correct: all or nothing. However, if you have time, we encourage to try some of it just for the extra fun and challenge, and maybe you will get it all.
As an extra challenge, add these two features to your Part 1 solution:
cp grades.c extra.cAdd it to your git repo to share with your partner and to submit it:
git add extra.c git commit git pushYou can compile extra.c to an executable named extra by doing:
gcc -g -Wall -o extra extra.c readfile.c -lmYou could try to modify the Makefile to add this command, but you do not have to. Here is some information about writing Makefiles if you want to try.
You should implement your extra challenge solutions in a good modular and generic way that will work correctly for any sized data set and any size histogram buckets.
40-59: ***** 60-79: **If you run on the same data set with a bucket width of 5, your histogram will look something like:
45-49: * 50-54: ** 55-59: ** 60-65: 65-69: * 70-74: 75-79: *If one bucket's range needs to be smaller than the others, it should contain the largest grade values, e.g. [..., 80-87, 88-95, 96-99].
#define HISTWIDTH 50for the maximum number of * characters allowed. Then, scale the number of stars for each bucket by the smallest power of 10 that keeps each line's length below that constant (rounding the number of stars up to ensure that all grades are represented). You should also print the scale so that readers can interpret your histogram correctly. If the file contains 1000 grade values in the 40-59 range, 1101 in the 60-79 range, and 25 in the 80-99 range, your histogram might look like:
40-59: ********** 60-79: ************ 80-99: * scale: * = 100 grades
cp ~newhall/public/cs31/makevalues.py .This program takes one command line argument specifying the number of values to generate. Here are two runs, one to generate 10 values, the other to generate 1,000 values:
python makevalues.py 10 python makevalues.py 1000You can redirect the ouput of a run of makevalues to a file:
python makevalues.py 10 > file_10 python makevalues.py 100 > file_100 python makevalues.py 1000 > file_1000This way you can easily generate files of gradevalues of different sizes that you use as input to your extra program. In testing the scaled histogram, you should generate some different sized files to ensure that the scaled histogram is working. However, don't go nuts with generating lots of huge files here. A few of different size, maybe the max of a couple thousand should be more than sufficient to test scaling. And feel free to change the makevalues program in any way you'd like (changing sigma and mu will give you different distributions of grade data) or write your own grade generator. Just be careful that it only produces values between 0.0 and 100.0 inclusive.
echo "yippie" > CHALLANGE_MET # or just open in vim and enter a short message git add CHALLANGE_MET git commitThen make sure to add extra.c to your git repo, commit and push:
git add extra.c git commit git push