7 kyu
Maid Ep2: Christmas Trash Party
229 of 292Schulzkafer
Loading description...
Fundamentals
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.
Hi, everyone. Is it correct test? shouldn't it be false? "assert.deepEqual(compareTrash(0, -0), true); "
hi:) you can verify it using ===, if it is true or not
Using an arrow function instead of regular brings this:
ReferenceError: Cannot access 'compareTrash' before initialization
(Node v18.x)
Correct. Don't change the function statement to an arrow function definition.
( This does not vary with Node version, it'll break in any. )
fixed, thanks;
"Random" tests use assertions with
actual, expected
in the wrong orderfixed. I'll resolve later other issues (need some sleep now)
The closing paren is in the rwong place.
fixed :)
Random tests aren't random
Not writing the exploit. But the tests are in determined order, so the expected values are predictable.
fixed :)
Restricting
"==="
should be done by reading the source file instead of relying ontoString
, because this ( and several other easy cheats ).The current setup also prohibits the
const compareTrash = $SOMETHING;
form.Anti-cheat has been invented already; better steal it correctly than reinvent it less than fully correct.
fixed :)
This comment has been hidden.
This comment has been hidden.
And AFAIK British police don't read Miranda rights. Ain't that a uniquely 'murican thing?
ahaha; Now I have applied the British version: UK Miranda Rights
But that's before questioning, not immediately upon being taken into custody.
ok; fixed the both; :)
PS: looks like I can't republish it anymore
Have you closed all issues?
This comment has been hidden.
This comment has been hidden.
Integers, whether signed or unsigned, won't have
-0
. But all languages that haveIEEE.754
floating point numbers will have-0.0
. ( JS-0
is actually floating point. )Got it :) Thanks for helping and approving! :)
putting the anti cheat in the preloaded section prevents users from converting the function to a variable like so:
because the preloaded code is placed before the user code in the final executable, so it is accessing the variable before initialization:
I fear the error will confuse many people. perhaps the anti cheat should be moved to the tests cases ?
No. The
toString
thing needs to be taken out, and thereadFile
stuff needs to stay.Fixed, thanks;
[], false, 0, '', new Array(), null, NaN, undefined
- no0n
?-0
and-0n
are also falsy values, but they make strict equality look bad ( though maybe no worse thanNaN
).(My solution has no problems with
-0
, but only with-0n
-> but my solution is not a reference). I think I will wait some votes about your sugestion :)I did a fork with
0, -0, 0n, and -0n
. It seems to work, and to test what you should want.( JS having four [ and internally even more apparently ] different equalities none of which still is value equality for non-primitives is, of course, ridiculous. )
Also have a look at the slight rework of the exhaustive tests. I feel clever. :P
I added the cases with zeros, I refactored tests using your logic, I implemented your/Fbasham solution for me (it's much better than mine), I didn't take the Elfein7Night' solution because it's going to be "the best practice".
Fixed :) Have a look please
.
Why is the Prince of Edinburgh levying fines in colonial dollars instead of pounds sterling?
( That should be Duke of Edinburgh BTW, not Prince. )
lol! :)
-> maybe because He needs dollars to travel to the United States -> Fixed;
Charles was originally styled "His Royal Highness Prince Charles of Edinburgh". https://en.wikipedia.org/wiki/Charles_III#Titles,_styles,_honours_and_arms
?
I think there's a difference between "Prince Charles of Edinburgh" and "Charles, Prince of Edinburgh".
Frankly, the story works as good ( maybe even better ) without distractions like actual factual correctness in this regard. Just keep it "Prince of Edinburgh". :D
done
maybe because He needs dollars to travel to the United States
No, the better answer is that He cares a lot about His employees and fines them with money of their origin :)