6 kyu
Investigator's holidays and hidden messages
123 of 127mauro-1
Loading description...
Strings
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.
Great riddle to solve.
Wow, thanks for this! I enjoyed it.
Nice Kata !
Thanks.
Very funny and creative Kata.
Don't bother pedant comments...
Great kata, loved it!
But I had a solution which passed all static tests and I only failed random tests. It was nearly impossible to debug. Add smaller random tests or add some more fixed tests.
Thanks for this nice puzzle :)
I really don't think this is an issue. Maybe a suggestion. It's a puzzle for a reason.
Updated random text generator (old version sometimes generates unwanted problematic text).
This comment has been hidden.
Yes.
As pointed out below, with the current task design there's no reason to use OOP here. The
Investigator
class could be replaced with a single function taking a list of messages, and returning the hidden message. You should either redesign the task so that storing state between method calls is required, or just get rid of classes altogether.Not an issue.
Storing state between method calls is required, since there in't a list of string, but single strings that arrive one at a time.
There are alternative designs, with pros and cons:
You may prefer (3) over (1), but it's a preference, not an issue.
Note that with (3) you have to write more code (at least a for loop or a comprehension).
(3) has the advantage that you can write a single-line illegible expression with one-char identifiers, lambda and nested comprehensions. :)
This comment has been hidden.
And what if the class is fed through a server, receiving messages one by one at random moments and triggered from "outside"?
The design being arguable in the context of CW doesn't mean it cannot make sense. As long as it's not becoming the default rule, it doesn't hurt to encounter this from time to time.
Apparently we communicate using downvotes now. Lovely. I didn't see cause to downvote the kata, was I supposed to since I disagree with something? I won't be doing that, this is not threat or retaliation. But downvote shouldn't be a "I disagree" button, that creates a chilling effect on other people's opinions - because they get slapped when you don't agree with them. Maybe we need scripts to extra downvote people's other posts yeah? Yikes.
(I'm not the one doing that...)
No, and, I find your arguments excellent *hugs*. I'll see myself out. I said what I think of this class pattern and I'm happy with that.
There's an input of a list of strings. There's an output of a string. That's a function. What is the class doing?
You can do this with fibonacci too.
If a class is to be used, then it's because a function doesn't do the job. Otherwise skip the extra wrapping.
Using a class is fine here. It's not the best choice, but it's also not a terrible design like creating a class with a single method which some older katas used.
This could be a suggestion, but not 100% an issue.
My point is that there is no state to track. No closure needed. Just a function from
[str]
tostr
The closure only exists as an adapter to the weird API, it has no part in solving the problem.Like I point out, you can take any function with input and output and split that up into an input "method" and an output "method", each doing half the work, or, more likely, one doing something trivial with the other one solving the problem seeing as it is morally a single function. This is the case with your solution - a trivial init and output, and in the middle goes the actual solution. You too have a closure adapter around your function.
It is an issue in my view that the problem is wrapped up in something that does not add value. Some problem sites other than codewars put everything in a class, and all it ever does wrap the solution function. This is silly and I'll fight it. This is the kind of thing that makes object oriented programming impossible to understand - every piece of content that might introduce it does so by not solving a problem, by doing nothing, and it says nothing about purpose. But it might not be an issue as defined here, I yield on that.
I misunderstood your comment at first, and replied before I realized its point. Sorry about that. I 100% agree that using classes for no reason is bad design, and is an issue. I'll reraise it myself.
.
woth --> with
At first glance text --> At first glance the text
Fixed.
actually it's probably meant to be:
the text on the postcards
this isn't making any difference with the previous situation... :/
If I give the algorithm, it isn't a puzzle.
but you can give the expected result in the last section, instead of giving an useless assertion message.
I feel like this is one of those rare instances where having the output detracts from the quality of kata. Normally I'd agree that having a useful output is required, but given that a number of people have solved this (and in a few different ways), I don't think there's an issue here.
Except that so far, none of the possibilities I imagined are the good one. Meaning I'm clueless with absolutely no chances to get any useful feedback to unravel what I missed. Is that the definition of a good feedback?
@mauro-1: you can go the other way around too: give some more examples in the fixed tests? (or another batch of fixed tests after the user pass the 2 first sections?)
Added a fixed test.
(so... that was it.... XD )
:+1:
Figuring out the spacing was a pain, but overall very enjoyable.
hi,
you either need "better" (as in either more explicit, or more of them) hints to find how to spot the spaces, or you need to show the expected result for the second part: knowing that I'm too short or too far isn't helpfull at all... (especially when the messages have no meaning)
It's kind of deducible from the first test, so I guess the necessity of that depends on how puzzly it is supposed to be...
the one where there aren't any, you mean...? x)
This comment has been hidden.
Changed error message when it's all correct except...
This comment has been hidden.
This comment has been hidden.