6 kyu
JoJo's Bizarre Kata
388 of 851GiacomoSorbi
Loading description...
Fundamentals
Regular Expressions
Strings
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.
Possible Java translation
slight issue but maybe add some edge cases as a regex that could passes for Jon Dajohnson could pass all python test cases
Ruby fork which resolves the issue below me (link) + simplifies the test coding.
P.S. Oh and also if this fork will be approved, I think I'd like to try implementing fixes for the other issue (this one, under spoiler tag), if nobody is against it :)
Approved, thanks!
Ruby testing is broken: even if you solve the kata without regex, it requires from you to put smth inside of it, or else it drops the error
No examples found
. For other languges this problem does not exist though.Fixed in OP's fork
I've only done the regex yet and it gives me an error by testing and attemt:
okay, I simply had to use the method too (I checked my regex in it) and than it works. The instruction reads like it would be possible to do only the regex but that didn't work...
Seems like that's the bug for Ruby testing; raised an issue about that
Instructions: " ...either create a regex expression or a function to find... " But sample tests have a check of regex only.
JS: sample tests are broken
corrected
the image link is broken (description)
removed image links
NameError: name 'randint' is not defined
When running the random test cases...
The random.randint import seems missing from the testing file.
should be ok now. Plz reset the trainer (copy your current code first)
Agreed, it's solved. Thanks.
what i can do about it "name 'Test' is not defined. Did you mean: 'test'?"... just in google collab all ok...
reset the trainer (copy your current code before)
This comment has been hidden.
Node 12 should be enabled (Refer this and this for more info)
python 3.8 should be enabled and Python new test framework should be used (Refer this & this for more detail)
Updated JS to Node v12
.
Ruby 3.0 should be enabled. Description formatting is broken.
fixed
This comment has been hidden.
And how should names consisting of 1 word be handled? There's no "first name and surname".
I think that the cases with one word can be considered either as first name or surname, BUT not the both at the same time, so it should be obvious it's invalid.
(I know there are people which surname and personal name are identical, but it's not the case for this kata though.)
It seems this problem has been fixed by itself or by someone; either way, couldn't reproduce that rn, so resolved
Traceback (most recent call last):
File "main.py", line 3, in <module>
built_in_test_function("Jonathan Joestar", True)
File "/home/codewarrior/setup.py", line 8, in built_in_test_function
sol1=re.search(regex,name)!=None
NameError: name 'regex' is not defined
I am neither deleting anthing nor doing anything
Can confirm this is true for python sample tests.
You should raise this as an issue.
It's the same issue happening on other katas when Python runner changed to module-based execution; things in Preloaded/Code/Fixture aren't simply available to each other anymore.
.
need better tests.
Very small thing but I'm not entirely sure from description whether a three-word name can be valid, e.g. Joseph Joestar III or Joanne Evelyn Josephin or whatever. I passed the test but it didn't come up. This part in the description
you still may consider the first word as the firstname and the last word as the surname
makes me suspect that 'Joanne Evelyn Josephin' would pass but 'Joseph Joestar III' would fail, but to me the description isn't really clear (especially since one example of a failing name is"George Joestar II"
, which makes it seem like the reason for failure is theGo
and not theII
, ifJorge Joestar II
would also fail). It looks like maybe you discussed this two years ago with @sayfidz, below, but I'm not sure what the conclusion was.Thanks for the kata! The two-solutions-option is such a lovely thing, really appreciate you doing that.
My pleasure!
/me strikes a pose
hahahahaha
almost an issue but well... Let's rather say a suggestion: ;)
Your specs strongly ask for the two following tests:
Currently, it's not tested.
added testcases
"Joe Giorgio"
and"Giorno Baggio"
This comment has been hidden.
300 jojo fans, great DAZE.
This comment has been hidden.
This comment has been hidden.
hey there, i am very new to this regex style of programming, so i need some help out here. What i don't understand is how can i give input to the parameter when i am not calling a function? ex: regex=re.search('blah*',name) from where do i get this name parameter..
P.S. i am sorry if my question is a bit messy
You should usually use a regex (which you might consider more of a stand-alone language than a style) inside a piece of code; here my testing code does that for you :)
Soft.
I assume that's because I created it as a beginner kata for regex users, not to mention it was ranked accordingly...
This comment has been hidden.
I see your point, but being a VERY beginner regex kata, I would let it slip: if you can already conjure something like this, you are certainly able to pass also this very basic exercise, afterall ;)
No worries, I only mentioned it since I saw it in the top voted solution. I don't think most people would do this, but I do try to report gaps in kata test when they come to light.
If you change your mind and want to test against it, here are some famous non-"JoJo's" that pass through this kind of a test:
Really enjoyed this kata. My solution may not be eloquent... but I'll refactor another day!
This comment has been hidden.
Good catch: tests added to all three languages, thanks :)
There's something strangely satisfying about getting people's solutions invalidated. :D
Germans may know about this better ;)
It's not just the misfortune of others, but the causing of said misfortune.
I know, but playing
sadism
sounded less cool ;)Hi, Can a single word be valid ? Cause the js version test let pass Johjo, Johjoh and Giohgioh for examples. Your test doesn't cover thoose cases, so i was wondering if it was a miscomprehension that it needs to have at least two words to be a valid Jojo's name. Sorry for my english, still nice kata.
Mh, godd point: no, a valid JoJo name should consist of at least 2 words. I'll look into it for the JS cases, thanks!
All of my random tests in Ruby were Jonathon Joestar, is this expected?
Oh, no! Oh, my god!
Fixed, I keep forgetting about the differences in Ruby's vs. Python's shuffle.
Thanks, man :)
Thanks! Oops, I failed a random test now! :)
Best
enjoyed this one. and sorry if i got a bit wordy on comments in my solution but hey you asked :)
Don't be sorry at all - that was precisely what I hoped for: great tutoring for newbies and I hope it get voted a lot (by me for sure as best practice) :)
Thanks for your feed and for your time considering my work and solving this kata :)
P.S.: you are right about Joe Giovanni NOT being a correct JoJo.
Ahh good, lately I've been trying to solve many katas with one line arrow functions. So this felt like a novel in comparison.
I really enjoy your katas. They are always well thought out.
If you have the time, would you mind taking a look at my katas?
I've not gotten much feedback on them and your opinion would be invaluable
Gladly: I have to finish a couple of translation I was on, then I'll dive into yours: from their name they seem pretty interesting :)
thanks :)
You have done a lot of Crafty work in the Test Cases, I was pretty amazed while solving the kata...:)
Thanks :)
It sucks that I HAVE to keep BOTH
regex
ANDis_jojo
in my solution while I actually implement only one of them. :(Point is the systems also check if you did BOTH and congratulates accordingly.
And I see little problem leaving one of the two as it is; should I specify in the kata template not to erase any of them?
Congratulates? How?
Anyway, you could just check if the item is present and then test it and congratulate if the tests pass.
It gives you a different message if you solve both.
And I thought of checking if the regex and function were still there, but I skipped that part, as I assumed most users would not erase the unused part and, conversely, it would have made the checking code even heavier.
And testing for two alternative possible conditions was not that trivial to begin with :p
Well, as you wish. :)
I added a message to not delete the unused one (in case you don't want to do both) and I may reconsider rewriting all the 3 test codes if many more users find it somehow unsettling.
As usual, thanks for your nth precious feed :)
This comment has been hidden.
I fear the point is not the "last" test, just the last that you did; try re-read the rules for getting if a character is a JoJo or not: your code certainly can't get them all :)
Yash have you read the description carefully??
The last test got me
This comment has been hidden.
The second version could not pass if you got something like "Joseph Joplin Clapton", as sayfidz stated below; I could add tests for that, but I fear that would not make for a good beginner kata, would it?
And adding tons of numbers and symbols definitely would not make a JoJo kata, other than the previous point :D
I don't know, do you think I should make it a bit harder, considering I did this for complete beginners?
I think you are absolutely right :)
I deleted the regex variable in the Python version as I solved the problem without Regex, but the tests seem to rely on it being there!
They do: did you try leaving it "empty" as it was preset?
I actually didn't expect any solver to cancel un-necessary parts, but maybe I could write a warning, mh...
Cool kata, thank you! A couple of potential edge cases: I believe that the solution would currently pass "Joseph Joplin Clapton" as a valid "JoJo", although I believe "Clapton" should be interpreted as the surname, which is not a valid "Jo", and therefore should not pass. Also, it looks like there is a fairly small chance that the random test cases will produce a situation where the first name starts with "Gio" and the last name starts with "Jo", or vice versa. A solution can pass the test cases (mine did) if it allows one name to start with "Jo" and the other with "Gio". It might be worth throwing in a couple more "Gio"s in the random test cases or a defined test case where one is a "Gio" and the other a "Jo". Thanks again for the creative kata. I like the option to solve it two different ways, and how the solution checks to see if you did. Very cool.
Good catch with the Clapton example: fixed solutions and check routines, so that it now shouldn't be confirmed as a positive.
The situation with Gio-Jo should already been taken care of; for the edge cases, I don't know: I'll ponder about it, but I would like to strike a balance between a stimulating kata and a kata easy enough not to frustrate total regex beginners, mh...
I also pondered about composing the random names in 3 parts, so that you could get, say, "Joseph Joestar the Pillar Man" (and that would be a character to see if you are familiar with the Battle Tendency saga :D), but for now I opted to get things a bit on the easier side. Names with either a Gio- name or Gio- surname should be rather likely already, aren't they?
Then again, I might reconsider: any further thought on the matter? Do you think that way it would get too complex for (almost) total beginners?
And finally thanks to you for your kind attention :)
I think you're right, the Gio-Jo situation should be left the way it is. The thing I noticed on the Clapton example was that the instructions said the last word should be the surname, and the surname should be the one with "Jo"... but I might be being too picky. Anyway, thumbs up from me! Thanks for this kata and your many other contributions to CW. I'm not familiar with Battle Tendency or the other characters you mentioned, but this kata has piqued my interest.
I think I'll decide in the next 48H or so if I am going to spice up things a bit with the name composition, possibly asking some novice friend I brought here to try if they can manage to handle this kata as it is and how it easy it was to them, other then - of course - listening to other precious feed like this one.
Thanks to you again for taking the time to share your mind and make very good points, it is one of the things that keeps me glued to CW :)
And in case you like anime too and may consider adding this cornerstone to the watched list, I would suggest to go on Crunchyroll and sort them clicking on "Oldest": the first (and more gothic) saga, Phantom Blood, is just about 9 episodes, so giving it a shot does not take that much commitment; Battle Tendency comes right after, the next 17 episodes, but I won't tell more as it is my favourite part and I may be a bit too biased on that.
Finally, I would also note that this last adaption is also quite faitfhul to the manga (I would be tempted to link a good version of that too, but I fear is a bit against the rules here), so it could prove to be a rather valid entry point into this very variegated franchise.
Tsugi ni omae wa "I want to translate it" to yo [=You are going to say: "I will translate it"]: if you do, please, try to keep the original format of this kata, allowing for both a correct regex or a correct function to solve it (with some extra message if you do both).
I know it is annoying, but I wanted a stimulating kata that both beginners and complete novices to regexes could go and solve to learn a bit about them, so the double road seemed to me like the best option. Hopefully, this kata will get a good number of good solutions, possibly commented, so to let others learn :)
[And sorry for the omae above; I know it is rude to use it, but it was just a quote from Joseph]