Ad
  • Custom User Avatar

    (Py) I suggest displaying the part of “expected” and “but got” where there is a difference. Apparently, "expected" and "but got" are actually shortened to just under 90 characters.

    In each of my failed tests, the result messages look like this:

    Expected:
    ‘p -= 1;\nif (*p) do {\n  *p += 1;\n  putchar(*p);\n  putchar(*p);\n  p -= 1;\n  put...’,
    But got:
    ‘p -= 1;\nif (*p) do {\n  *p += 1;\n  putchar(*p);\n  putchar(*p);\n  p -= 1;\n  put...’
    

    The displayed part of the two shortened strings of “expected” and “but got” match.

  • Custom User Avatar

    Issue with the PHP tests:

    These incorrectly replace multiple consecutive input or output characters (, & .) with just a single putchar / getchar call.

    This is incorrect, as while reading multiple bytes from input would only store the last, it would still consume multiple bytes.

    Same goes for the output: the written character would be the same each time, but it would still be written twice.

    (The interpreter in the tests would print Helo, World!, with just a single 'l', for example).

    I could get my solution to pass by implementing the same error, but that is obviously not right.

    Edit: Just noticed hotdonkey already reported this 9 months ago...

  • Custom User Avatar

    In description it is told that repeated "." and "," commands must act like repeated commands

    1. . command must be replaced by putchar(*p);\n.
      Example:
      ".." -> "putchar(*p);\nputchar(*p);\n"

    However to pass random tests i had to combine them to one.
    "...." -> "putchar(*p);\n"
    So there is either missleading description or tests.

  • Custom User Avatar

    What difference does it make if my algorithm, as a result of calculations, replaced this sequence "+<->" with a similar one "<->+" ? Or this "<<--<-<+>--+" (8 lines in C) to the optimized "<<--<--<+>" (7 lines in C) ?
    Why is kata hardcoded to one C variant, not realizing that other variant (smaller or equal in number of lines) can lead to the same calculation results? O_o

  • Custom User Avatar

    Shall I suggest that this kata expected result is 'suboptimal' ??
    My attempt passes the fixed tests, but the for some random test the expected contains
    "... *p += 2; *p -= 1;..."
    where my solution gives "..*p+=1;..." for those same both lines ??

  • Custom User Avatar

    I'm having an issue in the last performance test. It says "The translation was failed. - Expected: true, instead got: false" and the input it's "[[>?-+<]]..." repeated many times. What would be the expected output in this case? My solution is outputting the following:

    if (*p) do {
      if (*p) do {
        p += 1;
        *p -= 1;
        *p += 1;
        p -= 1;
      } while (*p);
    } while (*p);
    ...
    

    Not sure what I'm missing here.

  • Custom User Avatar

    Random tests in JavaScript are problematic because the user does not get to see the expected answer, meaning even if we log the input and process it line by line, we cannot see what the checker expects. In some cases it is clear the checker is rejecting a demonstrably correct solution.

    That being said, nice kata. To the people saying it requires too much performance for a level 4 kata, I wouldn't agree, you should just try various methods of parsing until you find the most efficient one possible.

  • Custom User Avatar

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

  • Custom User Avatar

    Kotlin translation, would someone mind reviewing this please.

  • Custom User Avatar

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

  • Custom User Avatar

    The python version trims the expected output so much that it's impossible to debug.

  • Custom User Avatar

    My C++ solution is failing with the following status (it passes basic sample tests and is indicating "General Tests" in green as well:

    Time: 2038 ms Passed: 1 Failed: 0 Exit Code: 139

    and an error which reads:

    test: ../../libcxx/include/string:1164:
    void std::__1::__basic_string_common::__throw_length_error()
    const: Assertion `!"basic_string length_error"' failed.

    It would appear that either I'm trying to use negative length strings (already checked there's no chance) or that the maximum C++ string size has been exceeded.

    Can someone enlighten me on the possible causes of the error?

    I'd also appreciate if someone could point me to where I can find a reference to what Exit Code: 139 means.

  • Custom User Avatar

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

  • Custom User Avatar

    basic tests 1 and 2 succeed but all random cases fail.
    As "ooflorent" already mentioned, my solution for [+..,,] also outputs:

    if (*p) do {
      *p += 1;
      putchar(*p);
      putchar(*p);
      *p = getchar();
      *p = getchar();
    } while (*p);
    
  • Custom User Avatar

    As already mentioned by @ooflorent, the optimization which deletes [] is not correct. I suggest to add a new optimization which transforms [...][..] to [...]. This optimization is correct and it can significantly reduce the translated code size in some cases. It also makes this kata a little bit more interesting.

  • Loading more items...