Grading


Testing your code

We will be grading your project by calling the method positions on test cases, and seeing if your output matches the expected output. You can test whether positions is producing the correct array by inserting the following code into your main method:


double[][] test = myNBody.positions(new Scanner(new File("data/planets.txt")), 100000, 25000);
for(int i = 0; i < test.length; i++) {
    for(int j = 0; j < test[i].length; j++) {
        System.out.print(test[i][j]+" ");
    }
    System.out.println();
}

This should output the following in console:

1.4956294976553436E11 2.9798154903465266E9
2.2788403506932733E11 2.409957795285363E9
5.765266792231076E10 4.784879361438483E9
330.8671434437699 2.820200096518896
1.0812917648253027E11 3.499427153160241E9

Automated Tests

Below is a list of aspects of your code the automated tests will check. Your code will still be checked by a TA, and passing all these tests does not guarantee a perfect grade.

  1. Does the force method return the right output?
  2. Does the distance method return the right output?
  3. Does the positions method return the right output?
  4. Does the positions method process files with comments correctly?
  5. Does the positions method use .next(), .nextInt(), and .nextDouble() to process files?
  6. Does the positions method process universes with only one or two bodies correctly?
  7. Does the positions method handle odd time steps correctly/is the timing for loop written correctly? (e.g. running with timeStep = 25000, and 25001 should both update positions twice using totalTime = 50000, but timeStep = 24999 should update thrice)
  8. Does the positions method process universes with 100+ bodies?
  9. Does the positions method call StdDraw.show() the correct number of times?

Point Breakdown

This assignment is worth 25 points.