5 kyu
Part 1: Evil Programming Government Restrictions
2,387 of 2,444AKJ.IO
Loading description...
Restricted
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.
Not hard kata)
python translation
C# translation
Improved JavaScript version
The test only check for cheating possibilites, not the output of the function. You can just return an empty string and it will pass.
Fixed
No sample tests
Node 12 should be enabled (Refer this and this for more info)
Fixed
This comment has been hidden.
There're holes in anti-cheat, and its implementation is absolutely terrible.
I think I might have broken it a little further introducing additional holes (it's so bad I have no ****ing idea what I even changed), but at least it's not "15-open-issues broken".
The whole thing should be rewritten, or ideally retired, as
5 kyu
rank is way too high for such an easy task, and we already have a white kata asking you to return a number without using numbers.Fixed
This comment has been hidden.
Nice kata, I had to unlock solutions because of the many 'broken' issues but I don't see how it's broken. The test suite strips the function definition(
function(){
and the closing}
) to get the inside of the solution, then creates a function from the resulting string to test against.So if you leave the function definition as it is and use semicolons, you will be able to write your code and pass. I don't know why it creates a new function or does that goofy procedure, but this kata was created October 2013 so there might've been a reason.
It's a long time ago that I created this, and I have no idea. But it's been broken many times, I think this is to get around some issue that we had. It's a bit crazy, and that's the reason I never did part 2... however maybe a part 2 should be created...
This comment has been hidden.
Could you elaborate? It works for me.
Sorry AKJ.IO. I was stupidly tired and should not have posted that issue- I should have been helpful and described my problem. As it is, 10XL's comment allowed me to finsih the Kata successfully. I would delete my comment- but cant? Thanks for following up.
Oh great, it's been broken many times due to the nature of this kata. Have a nice day!
OK, I think the trick to get this working (if you get weird errors when attempting a solution, like I did) is simple: Use semicolons in your function!
Why is this kata still showing up if it doesn't even work?
Please fix this kata.
SyntaxError: Unexpected token ) at Object.Function at NoNumbersObject
while the code works as requested.
This kata ever return: SyntaxError: Unexpected token ) at Object.Function at NoNumbersObject
This comment has been hidden.
This comment has been hidden.
.. I don't even get what it wants from me, but apparently it's broken!
This KATA has an issue, I didn't use any number and result was as expect yet couldn't match it.
https://en.wiktionary.org/wiki/beat_a_dead_horse
The content issue I am reporting here is that the test cases will not execute, with error:
However, based on what has been discussed, what with the author not having access to fix the content issue, I am elevating this to an issue against the website. As a user, my usual process when I discover a content issue is to report it to the author. What are we to do when the website denies access to the author?
The kata is dead; the website killed it. Then, to add insult to injury, it blocked the author from bringing it back to life. Even if that is the right policy decision in this case, which it seems is in question,...if configuration changes have broken a longstanding kata, why are users still being directed to complete the kata? Somewhere in here there's a bug.
https://github.com/Codewars/codewars.com/issues/268
Rofl so the author just leaves it broken then?
because of how the rules of kata editing go, no code changes can be made after 500 solutions have passed, this is a rule set on codewars even if the owner cannot fix or change the kata if they wanted to..
Actually, you can (or at least could a couple of months ago) edit if you find the way. I don't want to share it just in case but it's relatively straightforward and not very hard to guess. The real problem is that the author seems to be inactive and the only other contributor is jhoffner.
I'm a bit inactive yes, but I was back to fix it. However I could not get permissions to fix it, due to some rule. My orginal intend was to make more parts as well, but it turned out to be really hard due to the infrastructure updating, trus me needing to change it a lot.
So the story is, I can't edit the test cases and therefore I can't fix it.
But I would love to fix it!
@AKJ.IO. In the near future I will be looking into how I can change the 500 limit while still protecting users from having their solutions invalidated. For now can you just email me the changes that are needed and I will update for you? Thanks.
This comment has been hidden.
Sorry it's broken, but I can't fix it. I'm not allowed to edit it anymore :-(
aww so sad !!!
Broken:
SyntaxError: Unexpected token ) at Object.Function at NoNumbersObject
This comment has been hidden.
OP solved it, closing. The original solution posted above has a wrong syntax --> should be
+(++x)
This comment has been hidden.
Sorry it's broken, but I can't fix it. I'm not allowed to edit it anymore :-(
I also wrote code that did not have any numeric literals (I did not press a single digit key for that matter). I am guessing that those who actually solved this kata returned a string slightly different than "I can write numbers like, 1, 2, 3." If so can you share what is that slightly different string?
Hi, did you figure it out? I've got the same issue... Thanks.
Nope, still stuck!
it is still broken.
Fix it, please.
Sorry it's broken, but I can't fix it. I'm not allowed to edit it anymore :-(
This comment has been hidden.
Same as anton.standrik: unloced solutions throw the SyntaxError. Fix tests or remove kata. thx! ;o)
This comment has been hidden.
No use creating this issue as there are over 500 solutions so this kata cannot be changed
pretty sure admins are able to fix this.
I can't edit it. :-(
It seems to break really often due to the nature of the kata, it might just be a bad fit for codewars. Should we just remove it?
I think "deactivate"(if there is such option) would be a immediate solution. Remove it seems a bit unfair with those who already solved the kata, they will just loose their solutions.
IMO the right way would be to disable the 500+ solutions rule for admins. Thus avoiding future katas to get stuck like this.
I already sent this suggestion to codewars. Let us see what codewars admins will suggest.
It's a shame that they break, I would love to make even more crazy things like this - but I don't have the time to keep them updated and with it being locked it's even more hard.
Copied some of the solutions from "Unlock solutions"
Always got
SyntaxError: Unexpected token ) at Object.Function at NoNumbersObject
0 Passed 0 Failed 1 Errors
WTF!?
Pretty sure it's broken.
It's broken sorry, and I can't edit it.
Also having the 'SyntaxError: Unexpected token )' issue, tried adding spaces all over the place and changing the declaration, no luck. Someone fix it, please?
this Kata is broken, any answer with this error
That was weird, but funny when you already got whats going on. Thank for that Kata!
I also have the issue of:
Yet my code works fine if I test it in any other environment. Any ideas if this is an issue with me not understanding the requirements or if this is just an error in the kata?
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This snippet is bad, and the code should be read using the
fs
module.Tests are broken. Getting,
And no, I haven't used any number literals nor the
length
property in my code.Apparently this is because I wrote
instead of
Why's the difference? Why's the first one break it?
Probably because test cases uses 'Function.toString()' and there's some error in the test regex:
Getting the same error. After hours of trying I had to unlock the solutions to see that people had the same solution as I had!! this is so mental :(
Dumb test! You pass the first test by having a space behind 1, but the actual test doesn't want that space!
Relatively easy kata, but dumb test was set to verify it.
Evil Programmed Kata ?
Got same
TypeError
message as other before me. Too pity, the no-number challenge was funny!Issue seem not yet resolved.
I'll look in to it when I have the time, this week.
Could be broken by updates to the site :-) It's been a while since last i logged in!
Yeah the new Docker system broke the kata. You were doing checks to the global namespace for numbers, but now the global namespace has all kinds of numbers due to it being a full un-sandboxed Node instance. I've made a change so that the kata works for now, but you will probably want to find a way to make it more iron-clad.
Fine ! Thanks.
Thanks jhoffner! I havent really had the time to visit codewars in a long time, I might get back to it, it's quite fun. I'll try to make it a little more sturdy, in the future.
Cant even follow the description
This comment has been hidden.
Something must have changed since I made this. I'll look in to it.
As of 2024 ~~ 10 years later, your solution passes the kata, closing ! ^^
This comment has been hidden.
I'm going to come out and say it: Either the site is broken, the test is broken, or this is a bad kata.
I can come up with a lot of different solutions returning the correct result without the source code containing either a number literal or even the Strings 'number' or 'Number' (edit: and now even without using a function or operator that returns a number). But what the fuck do I have to do to make the
TypeError: Converting circular structure to JSON at Object.stringify
go away?The kata was not advertised as a defeat-the-platform-to-read-the-test-cases kata (aka Time Bomb). So... what gives?
Looks like its an issue that can be resolved within the CW testing framework. The issue is that an object is being passed to stdout witha circular reference and the framework calls JSON.stringify. We will be updating this shortly.
Thank you for looking into it. I was kind of distraught at the beginning.
@Grey @jhoffner has this been fixed yet ? I see the same error.
@marutiborker: Nope, the problem persists.
I noticed there are some irritating restrictions (you can't write your function as a named function expression). It is obvious he's using
global.eval
(or equivalent) somewhere. Just a haunch, but I think he's doing some string manipulation to removefunction() { ... return ... }
and then evaluates the rest (CW's eval doesn't seem to return function objects).I have since written my own function that does this to use in testing, and I don't understand why he doesn't allow comments in the function body:
The following would be much easier, and it allows function expressions/declarations and parameter-lists too:
The problem has been fixed, so marking as resolved.
I am same problems as @tobipch ! pases first test but gives "TypeError: Converting circular structure to JSON at Object.stringify"
Got this error:
TypeError: Converting circular structure to JSON at Object.stringify
I passed the first test. This error occured at the second one. There are absolutely no numbers in my code and also no number literals.
What do I do wrong
Same here :|
As of 2024 ~~ 10 years later, your solution passes the kata, closing ! ^^
For a question that is so closely related to pedantry (quirks and obscure details), it really should have a description that is correct: 'I can write numbers likes, 1, 2, 3.' does not include any numeric literals, that's a single string literal. Just say the source text cannot contain any digits and be done with it.
This did confuse me for a bit. These types of questions put me in the mindset of assuming a high degree of precision.
I am getting the following message:
Test Failed: returned 'I can write numbers like, 1, 2, 3.'
Isn't that the required output ?
I got the same. What is wrong here?
This comment has been hidden.
https://www.destroyallsoftware.com/talks/wat WATMAN! :D
What's the possbile reason I'm getting an Unexpected token error no matter what I submit?
I have come up with one solution and got past the test. But still got the error
TypeError: Converting circular structure to JSON
This comment has been hidden.
This comment has been hidden.
The test code for this kata does some interesting/questionable manipulations which basically require the solution code to be written in a very strict manner. For your solution, this amounts to using
var
statements and semicolons, and removing the commented line. It's a shame the kata description doesn't mention these details.I haven't understood the problem.
You need a good understanding of some of the odd ends of JavaScript. Type conversion is a hint.
Actually, shortly after making the comment, I understood what result was required and then there were many ways to do it... :) Thanks.
It seems that no matter what I submit, I get the error "SyntaxError: Unexpected token (". Anyone else having this issue?
Well, completed the kata after you, so there should be no issue with syntax errors unless it's from the submitted code. I've spent hours looking for wrongly typed brackets and sometimes it can be hard to see the difference between { and (... Post your code and mark it as "spoiler" then someone will be glad to help.
no idea on what to return
You have to return the String
I can write numbers like, 1, 2, 3.
... but you aren't allowed to write any numbers in your source code.Is the intent to not allow any other functions beacuse you can not? If so the description should say so.
already stated in description
This comment has been hidden.
This comment has been hidden.
Thanks!
Awesome!
Cool kata! Got me a little bit to understand!
Great rename!
I think the description should say "You can't use number literals in your source code." instead of "You can't use numbers in your source code.". Also the test case error for used number literals should say "used" instead of "returned".
Correct, thanks :-)
The previous description was actually more precise. If it's only number literals you're not allowed to use, the original code should be valid since it only uses nubmers as text in a string and not number literals. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Values,_variables,_and_literals#Integers
So what do you want us to return? I don't quite understand what you actually want the function to return.
Never mind, got it.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
Well, you could re-direct all prototype.length to output "BOOM" or such.
How would you do that? I tried but got a
TypeError: Cannot redefine property: length
then I looked it up and found this https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty#Redefining_the_length_property_of_an_Array_objectWell, I talked out of ignorance, sorry. Now I have to revise my thoughts of JavaScript, again (from bad to good and back to bad ;)
Perhaps you could redefine completely the Array-object? Probably not.
This comment has been hidden.
Great kata to demonstrate the oddities of the language.
Thanks, got any ideas for a Rank? I'm very unsure.