4 kyu

Bridge Puzzle

94 of 163ecolban
Description
Loading description...
Recursion
Puzzles
  • Please sign in or sign up to leave a comment.
  • HartlIKS Avatar

    TypeScript translation (based on existing Java Translation)

  • benjaminzwhite Avatar

    What an incredible kata, thanks a lot @ecolban I really enjoyed the time spent solving this. I was wondering why there was a recursion tag but it really is a kind of recursive logic puzzle - awesome!

    Looking forward to trying your other puzzles now :+1:

  • Boolboh Avatar

    I had problems with this Kata, then read a hint and completed it, but as far as I understand this hint (and therefore also a standard solution) is wrong. Samantha saying "Patricia cannot know what the two numbers are." not only knows that Patricia was not given product of two primes, but also knows that Patricia was not given a third power of any prime number (because then she would know that pair {a,b} is {p,p^2}). In my understanding it makes it a lot more difficult.

  • john_connor Avatar

    I suggest to add a few "out of range" pairs to Java's testCompleteSolution(). For example, (-1, 0) and (1, 232), they should give false on output.

  • haugk Avatar

    I have enjoyed this kata.

    Once, when running the "attempt", I got

    Traceback (most recent call last):
      File "main.py", line 37, in <module>
        y = randrange(x + 2, 500)
      File "/usr/local/lib/python3.6/random.py", line 199, in randrange
        raise ValueError("empty range for randrange() (%d,%d, %d)" % (istart, istop, width))
    ValueError: empty range for randrange() (501,500, -1)    
    

    Hope this helps.

  • Blind4Basics Avatar

    Small problem with the tests of is_solution, in python. ;)

  • Voile Avatar

    Python 3 should be enabled.

  • Jomopipi Avatar

    love this question

  • Jomopipi Avatar

    Approved. There were too many hints so I took some of them out.

  • DSchwettmann Avatar

    I can submit my solution with

    public boolean isSolution(int a, int b) {
      //TODO: Your code here.
      return false;
    }
    

    and, whilst the example tests properly fail, the commit test runs green. From what I can tell, only the three statement methods are tested.

  • DSchwettmann Avatar

    The example tests are completely useless, as running them will only ever tell you 'something went wrong'. More useful test cases would be

        //Statement 1
        assertEquals("Statement1 for 10", false, puzzle.statement1(10));
        assertEquals("Statement1 for 11", true, puzzle.statement1(11));
        [...]
        
    

    This way, you will know which test failed, in detail.

    Furthermore, by convention you should have a seperate test method for each method to be tested (in this case 4). This way each method would be tested seperately and tests could succeed even if a 'previous' method fails (whilst, with your tests, the entire test terminates at the first failed assert).

  • DSchwettmann Avatar

    The initial class setup for the Java version of this kata can't even be compiled. The class misses a } at the end and there may not be () after a class name (in Java).

  • zellerede Avatar

    This comment has been hidden.