Ad
  • Custom User Avatar

    After going down the wrong track for ages I've finally got it over the line. Seemed much harder than the other 5 kyu kata.

  • Custom User Avatar

    Aha, brilliant, thanks. Now using malloc rather than static. That bamboozled me for ages. Added 'const' back into the comparator and not using 'sizeof(char)'. Great help, passing now, thanks. Coming from higher level languages to come and grapple with memory management and pointers is something I'm finding really hard!

  • Custom User Avatar

    Just FYI, you can post your code here in this thread, if you mark your post as spoiler and use markdown code formatting.

    Now about your code: there's a lot going there, and there is a couple of problems with it. But the most important problem is that your solution suffers from buffer overflows. Did you try to run your solution in your local IDE, with all test cases given in sample tests? I changed your solution in two places by adding one character and it passed for me.

    Other problems:

    • returning a static buffer from convertToText is bad,
    • casting away constness in comparator is bad,
    • sizeof(char) is always superfluous and unnecessary,
    • ... some other more or less serious style and performance remarks.
  • Custom User Avatar

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

  • Custom User Avatar

    Sorry, but we can't see why either :(

    Maybe if we could see your code we could know why it crashes.

  • Custom User Avatar

    I see my c solution crashing the test with "Test Crashed Caught unexpected signal: SIGSEGV (11). Invalid memory access." but I'm not seeing why. Any help please?

  • Custom User Avatar

    The esolang series is really interesting and I'm delighted to have got through it. This last one, boolfuck, could have better instructions. A lot of time was spent figuring out what was meant rather than solving the problem.

  • Custom User Avatar
  • Custom User Avatar

    Ah yes, *lg, thanks, I'm a bit further along now. Please mark as resolved.

  • Custom User Avatar

    The questioned is answered but not resolved. Increasing packet length and so forth isn't affecting whatever the fault is afaics. The specific test case failing is reporting that my 'encode' function is not returning anything where it is passing without fault in my local environment. Without being able to get it to break locally means I can't debug it. It is expecting {"ijJ tipvme ibw", "f lopxo uibu z", "pv xpvme ibwf ", "b qfsgfdu botx", "fs gps nf!!!"} which is what I get locally.

  • Custom User Avatar

    Question answered.

  • Custom User Avatar

    Thanks - well spotted!

  • Custom User Avatar

    There may be other things, but you have an out-of-bounds access here:

    runners[i] = malloc(sizeof(char) * packet_len);
    ...
    runners[i][packet_len + 1] = '\0';
    

    (also, char unpacked[1000]; when you have no guarantee that the length will be < 1000 is very bad)

  • Custom User Avatar

    I'm at a loss as to why my C code isn't returning anything. My solution is based on the "First Variation on Caesar Cipher" which was fine. It's all sweet on my local system. What am I doing wrong?

  • Custom User Avatar

    C version: This was tough but many learning points taken. Allocating memory! Wow!

  • Loading more items...