Beta

Guess the (prime) number, digit by digit

29 of 32macambira
Description
Loading description...
Mathematics
Performance
  • Please sign in or sign up to leave a comment.
  • Blind4Basics Avatar

    Hi,

    opening as issue to avoid approval before a decision is made:

    I have (and some other users as well / Note: not the published version of mine, it's the one in the fork) a solution that works consistently with 5 guesses at most. I'd suggest to reduce the limit to that number, if that can forbid the somewhat "cheezy" approaches, like the second python solution. Thing is, I'm not sure this will totally forbid the approach, but that might make it tedious enough so that users will go to the expected solution.

    If so, that would make a good 4 kyu, once some additional tests/constraints are added (see discussions below)

    In any case, the tests must be rewritten (in python at least):

    • add the fixed tests first
    • the random tests must be wrapped in an it block

    Cheers

    • MattSchmitz Avatar

      I would like to mention that I have a solution that works in at most 3 uses of the helper function for all 8363 primes.

    • dfhwze Avatar

      It's been a while without any progress on the kata, perhaps we should aim at 5 kyu then.

  • anter69 Avatar

    Keep the number of tests (similar), but make sure to test some of the numbers multiple times, to avoid solutions like mine...

    Maybe add a few more numbers to the sample tests, from the top and bottom of the possible range.

  • dfhwze Avatar

    Ruby sample tests has incorrect method name

  • dfhwze Avatar

    c#: on submit error:

    tests/Fixture.cs(12,29): error CS0103: The name 'Util' does not exist in the current context
    
  • dfhwze Avatar
  • Voile Avatar

    This comment has been hidden.

    • macambira Avatar

      This comment has been hidden.

    • Voile Avatar

      This comment has been hidden.

    • macambira Avatar

      I've wrapped wrapper inside another wrapper, but with a function. I'm not very familiar with messing with Python's Data Model like that, so I'm not sure in how to implement the class the way you say, but I hope this could make this somewhat more difficult than previously.

    • dfhwze Avatar

      I'll mark as resolved to get you out of Draft. In case more tweeking is required, I suggest to open a new "suggestion".

      Issue marked resolved by dfhwze 3 years ago
  • eighdreeuhn Avatar

    How many test cases are there? I can only pass about 3300 random tests before timing out.

    • macambira Avatar

      It tests against every 5-digit prime number, so 8363.

    • eighdreeuhn Avatar

      Holy moly! I think I'll reconsider my approach...

      Question marked resolved by eighdreeuhn 3 years ago
    • B1ts Avatar

      Is it necessary to test them all? If so, you should consider adding a performance tag.

    • macambira Avatar

      I'm not sure? Like, the Python Solution takes ~1 second and the Ruby one ~3, so It's not like you have to worry too much about optimization, but if more people think it makes sense the tag could be added at some point.

    • dfhwze Avatar

      I would still add the "performance" tag. You only needn't to worry about timeout when using an appropriate algorithm :)

    • anter69 Avatar

      Boy, did I struggle to make it pass! And I'm not proud of my solution...