4 kyu
Bridge Puzzle
94 of 163ecolban
Loading description...
Recursion
Puzzles
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
TypeScript translation (based on existing Java Translation)
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:
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.
The sum of
p
andp^2
is even, which is ruled out bystatement1
.Yeah, that is true, my bad, thank you for a quick reply!
Can you mark the issue as resolved?
Done!
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.I have enjoyed this kata.
Once, when running the "attempt", I got
Hope this helps.
Small problem with the tests of
is_solution
, in python. ;)This comment has been hidden.
why not a fully random pair generation?
Done.
Python 3 should be enabled.
Done.
.
love this question
Approved. There were too many hints so I took some of them out.
I can submit my solution with
and, whilst the example tests properly fail, the commit test runs green. From what I can tell, only the three statement methods are tested.
Fixed. If you are happy with the fix, please mark the issue as resolved.
Yep, fails properly now.
The example tests are completely useless, as running them will only ever tell you 'something went wrong'. More useful test cases would be
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).
Fixed. If you are happy with the fix, please mark the issue as resolved.
BTW, saying that the "example test cases are completely useless" is not a quite fair assessment, in my opinion. I appreciate your feedback, nevertheless, and I have taken it into account.
Well, I will admit the wording was improper. The tests still fullfilled their purpose of testing the code. But they were 'useless' as example tests, which are supposed to help coders in figuring out why their solution doesn't work, since they, as explained, wouldn't actually say which test failed.
With the changes, they're much better.
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).
Fixed. If you are happy with the fix, please mark the issue as resolved.
Resolved as well, sorry if you felt spammed.
This comment has been hidden.
This comment has been hidden.