List of Common Mistakes for the 'Monte Carlo Integration' (Console-based) Assignment:



Suggested Percentage Of Assignment
(explanation here)
  Algorithm Implementation


Correctness (random numbers)

(Also, efficient use of memory/computer resources)

You should create a single Random object, and reuse it.  That way, you'll have one Random per program, which is all you really need.

Correctness - distance formula

The method that calculates the distance between two points should return a double, not an int.

Correctness - computing the estimated area

You don't calculate the estimated area correctly – it's the fraction of darts that landed inside the circle, multiplied by the total area you're considering.

Correctness - language details

The MonteCarlo estimate is arrived at using integer division – use real division, instead.

(Failure to complete part of the assignment) You don't calculate the error (difference between the estimate, and the actual size, of the circle - see the assignment for more details) -5%
Correctness - calculating error

You didn't properly calculate the error (it should be )



(Failure to complete part of the assignment) You didn't create an array (to hold the number of iterations for each trial).  This way, instead of hard-coding four separate cases into main, you could quickly & easily change how many trials, or the number of iterations per trial.


Robust coding - remains correct in the face of (reasonable) future changes

Instead of :
double [] OffPercent = new double[10];

you can do:
double [] OffPercent = new double[numThrows.Length];

This is preferable, since now you can resize numThrows & the rest of the program will auto-adjust(-1)

Robust coding - remains correct in the face of (reasonable) future changes

Likewise, your loop(s)  should loop until it reaches the Length of the sessions array, so that If you change the size of the array, the rest of your program will auto-adjust.

  Computer Efficiency            (Efficient use of resources, such as memory)


Don't create unused variables The variables r1, x, and y are unused – remove them. -1%
 Don't create unneeded local variables

For something like:
double distance = Math.Sqrt(((_centerX - x)*(_centerX - x)) + ((_centerY - y)*(_centerY - y)));
return distance;

you can instead write:
return Math.Sqrt(((_centerX - x)*(_centerX - x)) + ((_centerY - y)*(_centerY - y)));  

  Functional Decomposition



You should go back, and modify the MonteCarlo class so that you can use it for any size circle, and for any sized square.      

  Style / Presentation



You didn't comment any of your code. 

Identify the author of each file

You didn't put your name, etc, at the top of EVERY  source code file, including any files given to you. (The "etc" part includes the name of this class (“BIT 142”), and the year and quarter, and the assignment number, including the revision number) 

Quality of presentation

(Make sure that what you've handed in looks good)

Code that you've commented out, because you're no longer using it, should be removed before handing in the assignment.

Horizontal Indentation Your code isn't formatted entirely consistently – in your C# file, try doing a "Select All", then under the "Edit" menu, under "Advanced", do "Format Selection" -1%
Vertical White Space Your code contains excessive numbers of blank lines in at least one place.   
(OOP isn't required, nor expected, on this assignment, but sometimes students will have (and use)  prior knowledge anyways)


Proper encapsulation

Within your classes (for this, and future assignments) all data field, methods, properties, etc, should be marked public or private (or protected, or internal, if you choose to look those up on your own, etc) – you left this out in several places.

No points deducted, but feedback to students is good.
C# language specifics

If you're interested, look at the differences between  a class & struct – your AssignmentFunctions is a perfect example of where to use a struct (since it basically just exists to hold data)

No points deducted, but feedback to students is good.
  General Assignment Mistakes  
Submission Mistake You included the "Debug", "bin", or "obj" directories, and you shouldn't have. The assignment specifically said not to do this.

These result in point penalties, since the student has failed to complete one or more parts of the assignment, even though no particular percentage has been assigned to this category.

Submission Mistake

You didn't include the project files, please do so in the future. The assignment specifically said to do this.



Explanation of Percentages assigned:

Please note that for any given category, the total of the penalties may add up to more (or less) than the total for the category ; many of the mistakes are mutually exclusive (and since they therefore can't all apply, it's ok to add up to more than the category total), and if the student doesn't include any work in a particular category, it is suggested that you remove all points from that category (even if the individual items don't add up to the category total)


Note:  While this list is intended to be as comprehensive as possible, it is not exhaustive - it is possible for students to make mistakes that aren't listed above.  Students should be aware that they may receive feedback (and point penalties) for such mistakes.


This document and the related materials are developed with support from Microsoft Research Computer Gaming Initiative under the Computer Gaming Curriculum in Computer Science RFP, Award Number 15871.