Ad
  • Custom User Avatar

    Actually awesome kata idea, but the execution is... oh boy, where do I even start

    First of all, you need to read the general authoring guidelines and C++ authoring guidelines

    Here's some issues and thoughts I have:

    • The Preloaded section does not follow guidelines. It's specifically told not to do what you did there. Just remove everything out of preloaded section and move all of these headers to the sections where they are used.
    • Again, it is told specifically not to keep using directives in the global scope. Please, get rid of them too.
    • Why generateRandomNumber() is left to the solver to implement? The test suite should be responsible for generating randomness, it's the whole point of the tests.
    • What is the point of _main() function in the initial setup? I genuenly don't understand the idea behind it.
    • Why even enforce the specific way the user has to solve the kata? Why the solver has to implement all of these functions, if in reality the only function that is properly tested (and should be tested) is acceptGuess?
    • Your tests are practically non-existent. You have 2 static test, and 1 test which doesn't really test anything at all. Solution like this is sifficient to pass them.

    So, I would rather suggest to carefully read the guidelines, draft this kata back and re-make it from scratch with solution setup like this:

    #include <iostream>
    #include <string>
    
    void acceptGuess(std::ostream& out, std::istream& in,
                     const std::string& expected_number) {
        // The solution goes here
    }
    

    If you need any help with the authoring, you can ask on our discord. You can get there by clicking "chat" in the sidebar menu.