List of Common Mistakes for the 'Insect Garden' (XNA-based) Assignment:



Suggested Percentage Of Assignment
(explanation here)
  Algorithm Implementation


Code is robust in the face of later code changes Look for a way (using existing, provided code) for you to get the height and width of the screen (rather than hard-coding this in).  As a hint for this assignment, try searching the source code for the word ‘student’ -4%
Correctness - distance formula

You need to keep track of the information (# insects seen, # caught, etc) using instance variables, so that the data won't disappear.

(Failure to complete part of the assignment)

You don't calculate the percentage of insects that have been caught.

Correctness - C# language details

The percentage of insects caught is arrived at using integer division – use real division, instead.

(Failure to complete part of the assignment)

You don't calculate the average point-values of all the insects that have been caught. 

(Failure to complete part of the assignment) You don't display (in the string that InsectStatus returns) the first five point-values for the first five insects that are caught. -7%
(Failure to complete part of the assignment) You don't display (in the string that InsectStatus returns)  values that haven’t yet been filled in as having the value “-1”, as demonstrated in the sample (pre-compiled) solution -3%
(Failure to complete part of the assignment) You don't place new insects randomly. -7%
(Failure to abide by the restrictions set forth in the assignment) You don't place new insects randomly, and within the screen. -1%
Correctness - wrong type

(This is probably a cut-and-paste error from the example instance variable)

You've added an 'counter' instance variable as a float (or double, etc), but it should be an integer. -2%


(Failure to complete part of the assignment) You don't use an array to keep track of the point-values of the first five insects that are caught.


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 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)


Selecting most appropriate data type Why are (almost) all your instance variables doubles?  Some of these variables should be doubles, certainly, but things like counters / array indeces / etc shouldn’t be. -2%
 Don't create unneeded instance variables ____ don’t need to be instance variables – look for ways that you can use local variables, instead. -2%
Don't create unused variables The variables r1, x, and y are unused – remove them. -1%
Don't create unneeded objects

You create a new Random object each time you create a new insect.  Since you (most likely) won’t create an insect more than once per millisecond, you will (in all likelyhood) get a random number each time (although – what happens if you create an insect in the player’s net?).

However – it’s more efficient to create a since Random object, and then repeatedly (re)use that one, rather than creating an new object, using it once, and letting that object then become garbage memory.
 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)));  

  Style / Presentation


Please give your variables that indicate what the variable is used for -2%

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 (“Computer Science 1xx”), 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.   
  General Assignment Mistakes  
(Failure to abide by the restrictions set forth in the assignment) You modified part of the program, other than those parts of the program that supposed to be modified for this assignment.
NOTE: If you check with the instructor first, this penalty may be reduced or eliminated, on a case-by-case basis.  In general, modifying other parts of the program to make the program more fun, more cool, etc, have a good chance of being approved by the instructor.  Modifying other parts of the program in an attempt to avoid working/thinking hard for the assignment will always be penalized
(up to)
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.