7 kyu
Smart Toaster
296Peter Rhodes
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.
Code length is tested incorrectly.
Very challenging kata. Thanx.
This comment has been hidden.
If one uses 'letorconst` or other ES6 features, the code will get longer due to the transformation by babel. That should get mentioned in the description.
I have added this to the description. Thank you.
Pls help I've done a character count elsewhere it shows 245, the test says 280? I also sneakily tried assigning strings to vars at one point, which brought the actual count down further, but in the test it went even higher! confused..
is there a way to do this in fewer than 250 chars without using regex? My only exposure to JS is completing a Codecademy course and some level 8 and level 7 katas. Based on my limited experience, I instinctively reached for a 'switch' statement, but that puts me around 350 chars, even after smushing my code together as much as possible. I suspect that I'm missing a more elegant solution, but I don't know regular expressions.
Check out ternary operators :)
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
OH my bad, it should be all in lowercase, THANK!!
I post this issue because your random test is not really "random", all of them are invaild bread, could you put some "good bread" in your "random" test?
I've sorted the test cases! They are now officially random. Thanks for the support myjinxin.
My solution has 250 characters but in test i wont pass. It said that i have 324 characters:( BUG!
If you use 'let
or
const` or other ES6 features, your code will get longer due to the transformation by babel.Please add this information into description. It can be confusing.
It looks like
constructor
s can be put in many toasters...Needs random test cases
My thoughts behind this was that because there is a character limit you wouldn't be able to simply return all of the results that the test cases are asking for. What do you think?
The character limit should not impact a thing :)
I have created random test cases finally. Is this ok?
The random tests aren't very effective, but it'll do :)
@Peter How many strings generated by
stringGen
will actually be valid? See this solution for a workaround.By the way, that "cheat" above can get reduced by a randomized order of tests.
I've done it!! The test are now properly random. THANK YOU for your patience and help!
As I told you personally a little while ago, awesome kata Peter :)
I would just add some less lenient tests to the ones already in, as some solution like the one from Pete would not pass in that case (I still like his solution and he made a smart bet in developing that, bravo!); strangely enough, I did NOT go for the regex approach and I still wonder if there is some way to improve significantly my solution already under 200 chars (I could take some tip from Pete, mh...), but had a blast solving this.
Special kudos to Raul for thinking out of the box in a really simple, smart way :)
Thanks Giacomo. Are there any specific changes you suggest I make? Making these test cases stretched my quite a bit so I might struggle to make any major changes.
This kata still suffers from the same problems almost all katas with "character limits" do: it doesn't check whether there's additional code.
This comment has been hidden.
Second solution submitted now that the test count me as invalid! I got 249 characters... maybe the challenge should be to get exactly 250 charcters (no white space filling!)... that will keep you busy Giacomo!
if you would like peter, i would love to assist you in creating anticheat for this kata :)
Yes please Matt!! I have spent the last 4 hours trying to create a random test case for this Kata with absolutely nothing to show for it!
@pete, read my solution and remember I could just add a few spaces or use longer variable names ;)
Sorry I was away for awhile I haven't got to adding random tests and as it's now published I assume you have written random test cases :)
No Worries Matt. I have managed (finally) to get my test cases properly random!
Bravo Peter \m/