5 kyu
Logic Detective
29 of 99Ziliquas
Loading description...
Algorithms
Mathematics
Logic
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.
nice kata. note that you are evaluating a possibility, so the values of the variables can be either true or false
I'm really confused on one of the test cases. (I don't think this is a spoiler because it's just about the test case.) The test case is: (aOR!b)AND(cOR!d)AND(!cOR!dOR!eOR!f)AND(eOR!g)AND(!fORg)AND(bOR!c)AND(cORdOReORf)AND(!aORf)AND(dOR!e)AND(aORbORg) I think the feedback says that this test case is supposed to be True/valid (because my program gives the answer False), but I don't understand why.
As far as I can tell, if a is True, !aORf means f must be True (because !a is False), !fORg means g must be True, eOR!g means e must be True, dOR!e means d must be True, cOR!d means c must be True, and then !cOR!dOR!eOR!f is False because f, e, d, and c are True. So the solution a = True doesn't work.
If a is False, aOR!b means b must be False (because a is False in aOR!b, so !b must be True and b must be False), and then bOR!c means c must be False, cOR!d means d must be false, dOR!e means e must be False, and eOR!g means g must be False, making aORbORg False.
Since a cannot be True or False with all the statements evaluating to True, why is this statement valid? I'm clearly missing something here, maybe not even understanding the Kata as a whole, but since I can't even understand the test case, it's really hard to get my program to understand it. Can anyone help me out here?
I have the same problem. I think the answer should be "false"
Needs random tests.
In the test cases and sample tests for Python, the parameters to
assert_equals
are being given in the wrong order. It should betest.assert_equals(is_possible(expr),expected_value)
. As it is, if the user's solution returns True when False is expected, it will sayFalse should equal True
, when it should sayTrue should equal False
.I've put togeather a JavaScript translation. Could you please review it?
(I've left description as is and translated the test cases directly.)
This comment has been hidden.
I wouldn't say it's bad to try and generate all combinations. In fact there are interesting things you can do with the logic engine that generates possible solutions to an expression.
Added Python translation.