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
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.
force
method return the right output?distance
method return the right output?positions
method return the right output?positions
method process files with comments correctly?positions
method use .next()
, .nextInt()
, and .nextDouble()
to process files?positions
method process universes with only one or two bodies correctly?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)positions
method process universes with 100+ bodies?positions
method call StdDraw.show()
the correct number of times?This assignment is worth 25 points.