Ad
  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Hello, I'm stuck on the solution of this Kata.
    Basically I've solved, just I don't understand what kind of error this Kata expects from:
    I used // throw new Error(""); but it seems to not be the solution expected by the author so any tips/ suggestion would be helpful

    cheers

  • Custom User Avatar

    In JS solution :
    Test case does not meet description : speedError(8,2,[[5,1.82 ],[5,0.48]])

    Value 8 is bigger then ~5.
    Making radar position not perpendicular to road.

    Tested some aprooved solutions and this breaks pythagorean calculations.
    Math.sqrt(55 - 88) => NaN.

    I liked this kata but need some improvements.

  • Custom User Avatar

    Testing functions should not be put in Preloaded. They belong in the actual tests.

  • Custom User Avatar

    Node 8+ should be enabled.

  • Custom User Avatar

    The description is really unclear. I read the description many times and still has no idea what you meant by

    estimate of the distance between the officer and a point on the road (specifically, the point at which the car will be travelling perpendicular to the estimated distance)

    Or what that point is. You really need to put up a diagram or something.

  • Custom User Avatar

    Sample test:

    // Test that negative input for distance in readings array throws error
    Test.expectError("One of the distances in readings array was negative", function() { 
      speedError(6,3,[[-50,0],[30,1]]);
      });
    // Test that a 0 input for distance in readings array throws error
    Test.expectError("One of the distances in readings array was negative", function() { 
      speedError(6,3,[[0,0],[-30,1]]);
      });
    

    The second test does not actually test what is intended to be tested because it's shadowed by the condition in the first test (there's a -30 here).

  • Custom User Avatar

    Hi danmarcus. Check this test:

    distance estimate  actual distance             readings
            7               5              [ [ 1, 0.71 ], [ 46, 1.35 ] ]
    

    Is it possible that the reading of the distance from the radar gun to the car be less than the cop from the road?