Homework 5 Rubric

Submission and Other (10 Points)

Code Points Description
A1 2 Submission is zip containing nbody folder with python files
A2 2 Zip is named after uni, unzips to folder with uni-hw5
A3 3 Python files have correct names/imports
A4 3 Python files have good style

Part 1 - recursion (24 points)

Code Points Description
B1 2 Test case 1
B2 2 Test case 2
B3 2 Test case 3
B4 2 Test case 4
B5 2 Test case 5
B6 2 Test case 6
B7 2 Test case 7
B8 2 Test case 8
B9 2 Test case 9
B10 2 Test case 10
B11 2 Function is in the proper file, proper name
B12 2 Good Style (No globals, comments, well named vars)

Test Cases:

  1. exp2(0) -> 1
  2. exp2(1) -> 2
  3. exp2(4) -> 16
  4. isPalindrome("") -> True
  5. isPalindrome("a") -> True
  6. isPalindrome("aa") -> True
  7. isPalindrome("ab") -> False
  8. isPalindrome("aba") -> True
  9. isPalindrome("abcba") -> True
  10. isPalindrome("abcbb") -> False

Part 2 - centerOfMass (33 points)

Code Points Description
C1 4 Code returns x and y position as floats (either tuple, list, or array)
C2 6 Test case 1
C3 6 Test case 2
C4 6 Test case 3
C5 6 Test case 4
C6 2 Function is in the proper file, proper name
C7 3 Good Style (No globals, comments, well named vars)

Note: Small differences are fine due to floating point error

Test Cases:

  1. centerOfMass(np.array([[0, 0, 1]])) -> 0.0, 0.0
  2. centerOfMass(np.array([[0, 0, 1], [0, 0, 1]])) -> 0.0, 0.0
  3. centerOfMass(np.array([[0, 0, 1], [0, 1, 1]])) -> 0.0, 0.5
  4. centerOfMass(np.array([[0, 0, 10], [0, 10, 10], [10, 0, 10], [10, 10, 10]])) -> 5.0, 5.0

Part 3 - sumOfForces (33 points)

Code Points Description
D1 4 Code takes array/list of N 5x1 objects and returns corresponding array/list of N 2x1 forces
D2 6 Test case 1
D3 6 Test case 2
D4 6 Test case 3
D5 6 Test case 4
D6 2 Function is in the proper file, proper name
D7 3 Good Style (No globals, comments, well named vars)

Note: Small differences are fine due to floating point error

Test Cases:

  1. sumOfForces([]) -> []
  2. sumOfForces([[0, 0, 100, 0, 0]]) -> [[0, 0]]
  3. sumOfForces([[0, 0, 1935, 0, 0], [3, 4, 1936, 0, 0]]) -> [[6.0, 8.0], [-6.0, -8.0]]
  4. sumOfForces([[0, 0, 1935, 0, 0], [3, 4, 1936, 0, 0], [-3, -4, 1936, 0, 0]])