Ad
  • Custom User Avatar

    C++ version: Signature is C-style, which discourages use of modern C++, int ** is something you never ever should have to write in C++.
    Suggestion:

    std::array<std::array<int, 4>, 4> solve(const std::array<int, 16>& clues)

  • Custom User Avatar

    Great, approved! :-)

  • Custom User Avatar

    Awesome! Would have merged it, but it says the latest changes from the record must be merged first?

  • Custom User Avatar

    @adri326: Comment was directed at @ZED.CWT, who appears to be losing patience with me, judging from the number of question marks. Thanks a lot for your suggestions, I've updated the kata.

  • Custom User Avatar

    It would have helped to mention that we're now discussing the C implementation, instead of the C++ implementation. :-(

  • Custom User Avatar

    Added a sentence in the summary.

  • Custom User Avatar

    I could not reproduce the origin problem. I have increased the number of tests by 10x and inserted an assert(false) in the case no valid origin was found both in the test fixture and my solution, still my tests run through just fine. I've also changed the complete solution to return (1,1) instead in case no * was found, so that my complete solution and my validation solution contradict each other -- again without effect. Any help reproducing this bug would be appreciated.

    In the meantime I've extended the wording in the description to include the valid origin assumption. I will also add a comment to the custom types to explain that they should be used in the solution.

  • Custom User Avatar

    I don't know what I'm doing wrong, I'm really not seeing these errors on my end. I've pressed re-publish several times now in the hope it'll change anything, but I have not means to check whether the code actually changed other than resetting my solution. If it does not work this time, I'll just stop wasting our time and withdraw it.

    Nevertheless, thanks for testing, really! Please don't mistake my incompetence for reluctance to improve my kata, or even maliciousness.

    Regarding the types: I'm sticking to the approach because this is a beginner's kata, and code wars is all about "production ready" code. I always encourage younger colleagues to use speaking names and concepts from the problem domain to name their types, classes, variables, etc. Many of the katas on code wars really disregard this aspect, using std::vector<int> to represent 2D coordinates, int for things where negative values make no sense, and so on. Also, on the job you're seldom in a position to re-invent everything from scratch; chances are, you'll have to use predefined types like Pos and Board, whether you like it or not.

    Regarding the missing origins: I will investigate this right now; it should not have happened, my intention was that you may safely assume that there will always be a valid origin.

  • Custom User Avatar

    True, because it is not required; all test cases have valid points of origin.

  • Custom User Avatar

    Just checked it again, I can run the initial solution. Maybe you need to reset it to the current state?

  • Custom User Avatar

    Oh, so, do I understand you correctly: The initial solution was working until you removed code?

  • Custom User Avatar

    I'm sorry, I really took extra time to clean it up, but obviously I have zero idea how to test katas. ☹ In my preview the initial solution compiles just fine - any pointers how I could test offline, or at least preview how the website merges the different code parts? Not even the line numbers make any sense here.

  • Custom User Avatar

    Argh, dammit! Sorry, my first kata. Now it should finally work. 😅

  • Custom User Avatar

    Fixed.

  • Custom User Avatar
  • Loading more items...