5 kyu
Joyful Transpiler
18potzko
Loading description...
Puzzles
Restricted
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.
my solution begs to differ ;)
nice :) didn't think of that, hope you don't mind that I change the tests to catch it
My 9 characters solution time out, too lazy to work out another approach...
id love to look at it if you don't mind
This comment has been hidden.
This comment has been hidden.
Well, I did not complete this kata yet, I cannot see it...
sry, I didn't consider that, ill referance you to this valid python code: "𛈇 = 8 print('𛈇')" and to how your output look when used on it
I also added it to the basic tests to prevent people timing out without knowing why for this reason
I changed the code a little bit, then:
......
This comment has been hidden.
This comment has been hidden.
.
I have a "solution" with 12 unique chars, but 10???
I was stuck at 11 for a while. I think theres really only one approach that is small enough. It might be worth making the bounds ever so slightly larger?
I tried to find more solutions and found a few more in the counts of 11,12 and 13, I increased the char limitation to thirteen to allow for them as well
I've finally got a working solution that I'll submit once its out of draft again, but the nature of the kata made it a real pain to debug some of the tests. I strongly suggest that on a failed test, the input should be printed for user convenience.
I can add it but im cuirius as to why not just print from within the function for debug purpose?
Well because my function is a big jumbled esoteric mess because it needs to have at most 10 chars. So adding a print means adding it in my original code elsewhere, recompiling, recopying it over, then wait for tests to run again.
ah good point, ill add it and republish after voile clarifies what they meant in their comment
Yet in the full tests I am getting errors that "this code had 10 unique chars in it"
when I rewrote the count chars function I accidentally removed one finger, oops, solved
At least in sample tests: Tests run the transpiled code returned by user function with something like
exec(a:=joy(code1), names)
, which is an incorrect usage: Variables in Python are defined and looked up at local scope, not global scope, unlessnonlocal
orglobal
keywords are used.im unsure what you mean here, mind elaborating? the way I read it is:
exec(a:=joy(code1), names)
so, a = the code I got from the function as a string
and names is the "global scope" of the function I run after it is finished
so if the code is 'q = 5' or an equivilant code, then names['q'] == 5 is True
.
separated of the below problem:
please reduce the noise in the sample tests:
test.expect
(with the appropriate error message)uniqe
len(set(text))
is more readableI believe there is also a
test._pass()
, if you really want to pass a test without condition.yes, but I don't think that's what's needed here
the count_chars function was remade, at some points I had plans for what to do with the return values and since then I changed the tests so it would be irrelevant thanks for the pointer :)
(Remember to republish)
whoops thanks
Hi,
You need to give the actual specs of the inputs. With the current description, the task could go from 8 kyu to far beyond 1kyu.
Cheers
I have no idea what you're up to, but now that I see the sample tests, I'm not sure my issue is the right one... There is still an issue for sure, but I don't know exactly what it is yet. I guess the task isn't properly described/hinted.
The "puzzle" tag is not enough to justify this lack of examples. If the sample tests give you more info about what to expect, I feel more examples should be given in the description. For now, it seems a simple 'eval' should do the trick..
the sample tests rather lost me, actually. It's not about missing examples, it's more about the task is on a different level/of a different kind that what the description suggests at first sight.
for this kata the only specs I need to give for the input is that it is valid python code, and that the length is reasonable, I estimated the difficulty at rank 3
I know what im asking and why it looks hard/impossible however I stand by my estimate and I remind you that this is a puzzle
I will add more examples
So you are asking us to pass your specific test cases, not to have 'any' python code reduced to 10 (now 13) chars?
no, your solution should be able to pass for any single string of python code, and in N iterations N strings of python code (maintain state) however I only have some test cases as testing all features of python would be unrealistic
This comment has been hidden.
yes, although not exactly everything is allowed, you are guaranteed the source code is valid