Ad
  • Custom User Avatar

    Fixed

  • Custom User Avatar

    This was... very interesting. Awesome challenge, had to change my approach twice due to performance. Coming from the 4x4 kata, this was slight unexpected. After an amount of time I don't care to admit I finally arrived at a reasonable F# solution and the feeling is very satisfying. Thanks for the oportunity!

  • Custom User Avatar

    A small issue in the F# version: the tests have their actual and expected values flipped - whatever the tests say is "Actual" is the expected value and vice versa. Also, the large test suite wraps the function result in an Option so the tests might say that they expect null/some x. This is not entirely expected and might get confusing in conjunction with the expecte/actual flip.

  • Default User Avatar
  • Custom User Avatar

    No worries, stuff happens. Now my code worked without issues, thanks for solving this so promptly :)

  • Custom User Avatar

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

  • Default User Avatar

    You are right, there is a problem in randomtests: "they code only letters a-z, A-Z" so the string must not begin with a character outside a-z, A-Z (here, if it begins with "|" this character should not be coded and the prefix would be "||" hence the shift would not be known). I modified the randomtests. I hope it will work now for you! Unfortunately it seems that you are the first to try the F# translation:-(. Thanks for your post.

  • Custom User Avatar

    Either I'm missing something or there is something wrong with the F# tests. Most of the tests are passing fine, but:

    For (encode "|5F60Au? KZi92? n" 2) the expected output is ["|d|5"; "H60C"; "w? M"; "Bk92"; "? p"]

    How does that work? To build the prefix, I should take '|', lower-case is to '|' (no change) and then add 2. Since '|' is ASCII 124, that would give me ASCII 126, which is '~'. Instead, the expected result says the prefix is "|d". How did that 'd' get there?

  • Custom User Avatar

    Alright, never mind. Gave up, looked at the reference solution. Two issues:

    1. The link to BBC is dead. Got the alpha, forgot the sin (that's what I get for doing this at 1AM)
    2. Distance in t is updated using speed when ENTERING t (in other words, acceleration computed in t affects speed in t + 1)

    Generally speaking, this was rather frustrating. The task is not difficult but there is a lot of space for uncertainty and the test suite is not sufficient to guide you to what part of the computation is problematic. The whole thing is further complicated by the floating-point math and small increments which mean it's difficult to visually check if the computation makes sense.

  • Custom User Avatar

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