Ad
  • Custom User Avatar

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

  • Custom User Avatar

    You can avoid creating a list (an extra O(N) operation) by doing { 0 .. n-1 } instead of [ 0 .. n-1 ].

  • Custom User Avatar

    This will be O(N^2) and can overflow the stack. There's a better solution that's O(N) and cannot overflow the stack; it involves creating an inner loop function that takes an accumulated-result parameter. (If you look at the other solutions to this problem, any that define an inner function with a parameter named acc have probably implemented this solution).

  • Custom User Avatar

    True enough that it's functionally identical in this case; it's the third test in the series where the count of instructions executed actually matters to the result.

    But it still bothers me that the test description is incorrect, and that 1-kyu and 2-dan people are casually dismissing an incorrect description. Correct test instructions matter, even if the results would be identical.

    Difference in philosophy, I guess.

  • Custom User Avatar

    The issue reported by DSchwettmann 11 months ago should NOT have been marked as "resolved", as the description:

    1. Is still unclear (it implies that [ should jump TO the corresponding ], when in fact it should jump PAST it), AND
    2. Is wrong! The official Boolfuck site describes [ as "If the value under the pointer is zero, jumps forward, just past the matching ] character" (Emphasis mine).

    The description needs to be revised to give the correct instructions for the [ character. The number of people who have successfully completed this kata is irrelevant to this issue, since the description does not match the actual behavior and is therefore, quite simply, wrong.

  • Custom User Avatar

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

  • Custom User Avatar

    Disagree with this being marked resolved. A 7-kyu kata should not require people to go to Google to get the tests, whose source code they cannot see, to compile. This is newbie-unfriendly.

  • Custom User Avatar

    The progression that @Pigankle posted uses floating-point numbers, and does not round down at each step. The problem statement doesn't ever explicitly say that it expects you to round your guesses to integer at each step, but the final line (suggesting the use of Math.floor "for each integer approximation") is trying to suggest that. However, the problem statement does need to be a bit clearer about saying "Your guesses should be integers at each step".

  • Custom User Avatar

    F# translation uses Int64 when it should use int64, so the random tests can't compile and no solutions can be submitted.

  • Custom User Avatar

    The reason is because the / operator meant floor division in Python 2, but means true division in Python 3. E.g., 5 / 2 will equal 2 in Python 2, but will equal 2.5 in Python 3. To get floor division in Python 3, use the // operator. See https://stackoverflow.com/questions/1282945/python-integer-division-yields-float for more details.

  • Custom User Avatar

    The one-line requirement for F# is a bad idea, as it leads to unreadable code. It's better to write one expression, but have each pipeline step on its own line for readability. I wrote a working solution, that passed all the tests except for the one-line requirement; to get it accepted, I literally just deleted newlines, turning a readable function into an unreadable, Perl-like mess.

    Also, the one-line requirement in the tests should ignore comment lines and blank lines. If I'd been able to write comments, I would at least have stood a chance of writing decent code. As it is, the solution requires me to produce an unmaintainable mess that would NEVER pass code review, at least if I was the reviewer.

    If the one-line requirement weren't there, I would have been satisfied with this kata. As it is, I ranked my satisfaction as "None" because the fact that I had to write an unmaintainable mess is really bothering me.

    P.S. The lack of any real sample tests is also bothering me, but that's already tracked in mentalplex's issue.

  • Custom User Avatar

    F# translation needs an "open System" in the test code, otherwise you get an error that the name "Random" can't be found. (It can be worked around by adding "open System" to your solution. But since my solution didn't need the System namespace, my solution was correct but failed the tests until I added "open System" as the first line.)

  • Custom User Avatar

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

  • Custom User Avatar

    Agreed; the invalid case should return 0 rather than false.

  • Custom User Avatar

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

  • Loading more items...