Draft
Periodic Table Decoder
Loading description...
Algorithms
Strings
Parsing
Regular Expressions
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.
Well, I have to say... This is quite poorly designed, sorry... :-s
ELEMENTS
Doesn't exist
is expected, notDoes not exist
decode
... And that is supposed to encode too. That's quite confusing and bad practice (and illogical)!I was happy to do a kata about chemistry but it was somehow a painfull experience, finally... ;-/
Apologies, I made this a year ago when I was still a noob coder and haven't changed the Kata since. I'll take this off beta into draft and will maybe improve it when I can be bothered. Thanks for the feedback, Blind!
One of the test cases is 'Carbonite' My code translates this as a valid list of chemical symbols, but get the message
'Carbon Argon Boron Oxygen Nitrogen Iodine Tellurium' should equal "Doesn't exist"
Have I misunderstood something or is the test case wrong?
A really good Kata, liked the other periodic table one too.
I had misunderstood something. I was allowing case variation. If I use the case of the letters in the supplied string I get the correct answers.
Sorry & thanks.
There are misprints in basic test cases:
Test.assert_equals(decode("NaNaNaNaNa", "Sodium Sodium Sodium Sodium Sodium")
instead ofTest.assert_equals(decode("NaNaNaNaNa"), "Sodium Sodium Sodium Sodium Sodium")
andTest.assert_equals(decode("Sodium Sodium Sodium Sodium Sodium", "NaNaNaNaNa")
instead ofTest.assert_equals(decode("Sodium Sodium Sodium Sodium Sodium"), "NaNaNaNaNa")
. To make the kata harder, you could mix elements and symbols in the input string. Anyway, nice kata, thanks!