6 kyu
Get Euchre Score
57 of 210Dana
Loading description...
Games
Arrays
Algorithms
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.
The rules of the game are absolutely unclear. Therefore, the conditions of the problem are also unclear.
Python: generates warning after completion.
/workspace/default/tests.py:9: SyntaxWarning: "is" with a literal. Did you mean "=="? if called_trump is 1:
Fixed in OP's latest fork
Python: Random tests are vulnerable to input modification
Fixed in OP's latest fork
python new test framework is required. updated in this fork
Approved
This comment has been hidden.
JS version needs fixing, tests labeled "Random" are not working at all.
Fixed
My solution succeeds on every test until it gets to the random tests, where it fails with this error message:
ReferenceError: teamOneTricks is not defined at testUpdateScore at /runner/frameworks/javascript/cw-2.js:179:21 at Promise._execute at Promise._resolveFromExecutor at new Promise at Object.describe at Object.handleError at ContextifyScript.Script.runInThisContext at Object.exports.runInThisContext
Yes in
JS
the random testing requires a function teamOneTricks which the author defined in his solution.@Dana
one way to avoid that is to move that function inside the kata function (updateScore
).@HerrWert
currently you can bypass this just by defining a functionteamOneTricks
and make it return trueThanks. But I have added the function, and now the random tests are expecting results that definitely don't match the instructions.
Hm that did it for me, I'm not sure why its not working for you. Sorry for the late response I didnt get notified that you commented.
Ah.. I didn't understand why anyone else would need to include that function. I'll fix the test cases so it won't be required.
Dana
Sorry about that. You shouldn't have a problem with the missing function anymore.
Thanks, but that still doesn't solve the problem of the incorrect random tests. Here's just one example of many: The arguments are { '0': [ 9, 3 ], '1': 2, '2': false, '3': [ 1, 2, 1, 1, 2 ] }
...and the result I get is: ✘ Expected: [9, 3], instead got: [11, 3]
Shouldn't it be [11, 3]? Team 2 caleld trump, but took only two tricks, so two points go to team 1, right? Or am I misunderstanding the instructions?
Is it possible the expected and actual values are reversed? You are correct, the answer should be [11,3] and when I test, this is the answer I receive. I did notice, that even though the documentation says to pass the test cases as (actual, expected), they are printed the opposite for me when I force a failure.
OK, so it sounds like it needs to be fixed in the test framework somehow. (I admit, on the only two katas I've written so far, I had a lot of trouble figuring out how to set up the testing and needed plenty of help -- especially for the random tests.)
If you let me know when you get it figured out, I'll run my solution against it again.
If your solution is correct, it shouldn't matter which order those parameters are passed. I can look into it further but you probably have a problem in your solution as well.
Well, after 4 months, I've come back to this kata as a (hopefully) better programmer and solved it without too much trouble!
I really admire how concisely you described the conditions for solving this real-world situation. These situations are sometimes hard to explain, and the descriptions can become very lengthy. (See my "Determine Results of Pole Vault Competition" kata; I just couldn't find a way to keep it shorter without omitting important information!) And I am the first one to skip a kata if the description is too long :-) So... nice job!
Hallo Dana,
i'm sorry to report, a bug hides in your random tests.
(C#-solution)
In your own solution you change the input array "currentScore". It's called "side effect" and can lead to the unexpected consequences. So as in your random tests.
Look at your random tests, after the exectution of your own solution at the code line 153 the currentScore-array is changed and has the "wrong" value for the user function at the code line 154.
My first solution was written with a new array returned and i could not pass the random tests because of this side effect.
The bug was hard to find without seeing the test code. I have spent half an hour reading the article about Euchre in Wiki, because i thought the error was in my solution.
After i have rewrote my solution with changing the input array, i can pass all tests.
With changing the input array, after execution of the both functions, the expectedScore and the actualScore are the same array (actually currentScore) and the assertions at the code lines 155-156 compare the result array to itself.
Therefore you and other who solved the kata could pass the tests successfully.
You should either rewrite your own function so that it does not change the input array and notice this point in the desciption or pass the currentScore in the random tests as a new array: like this currentScore.ToArray() (System.Linq).
It should be fixed now. Thanks :)
It was fun, but i still don't know how to play ^^