Beta

Accumulated skiing altitude

57 of 80barakplasma
Description
Loading description...
Arrays
Algorithms
  • Please sign in or sign up to leave a comment.
  • kplum Avatar

    In Rust, in some random tests the provided ids in the lifts list are not unique and the test can only be passed if you use the id's first appearance. This defies the concept of an id.

    Furthermore sometimes ids are passed in the rides list which do not occur in the lifts List.

    It either should be specified in the description what happens in these cases or the tests should be corrected.

    • barakplasma Avatar

      You're right, I re-published with better tests.

      Details

      I was relying on quickcheck before, but it's too random.

      I removed quickcheck, and replaced the random tests with one where the id's are guaranteed to be unique.

      I also made sure the rides id list is limited to the ids in the lifts id range.

      Issue marked resolved by barakplasma 5 years ago
  • xDimon Avatar

    random_quick_check [quickcheck] TEST FAILED. Arguments: ([Lift { start: -94, end: 92, id: 52 }, Lift { start: 30, end: 78, id: 52 }], [52])

    Is it correct to have different lifts with the same id? I think is a bug

  • Avanta Avatar

    You don't say how the sum of descents is actually supposed to be caluculated.

    Also, no random tests.

    • JohanWiltink Avatar

      There is actually a "random" test ( now? ).

      But please just wrap that in a for loop and run it a hundred times. Also, the random test doesn't seem to be random - look at the top Clever solution [ Avanta's, that is :]. ( The expected value should be random, not just the input! )

    • barakplasma Avatar

      added the following example calculation:

      Example

      if a skiier took lift #1 which starts at 100 meters, and lifts them to 1000 meters, they would have an accumulated skiing altitude of 900 meters at the point (1000 - 100). If that same skiier rode down the mountain and took lift #2 which starts at 500 meters and lifts them to 1500 meters, their new accummulated altitude would be 1900 meters ((1000 - 100) + (1500 - 500) = 1900 meters ).

    • barakplasma Avatar

      @JohanWiltink I added 106 more random tests, with more variation in them.