Retired
Open a weak chest. (retired)
51nevepura
Loading description...
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.
I really like this Kata, but in my opinion the fact that the BadCodeException will get thrown out if the inputCode for unlocking the chest is wrong should be writen in the description, as this wasn't immediately clear to me.
Thanks for the feedback. However, I think that the core of the problem is getting this surprise exception and finding out how to deal with it. So the description is not talkative on purpose.
Personally, I think this kata should be a 7 kyu kata because it contains only "basic functional or object-oriented concepts" (as the 7 kyu kata difficulty description says). It's not an issue whatsoever, but maybe something that can be changed to be more coherent(?).
Yes, kinda. I switched to rank 7, as suggested.
Does this mean we can we assert that all chests are openable, or might there be some chests that can't be opened even after testing every possible code?
Why does
lockpick
havethrows BadCodeException
in its declaration if it's supposed to open a chest successfully?It is supposed to open a chest successfully if given the correct code. Otherwise it won't open and throw the declared exception.
What are you talking about?
lockpick
doesn't receive any codes - it generates them itself.You are right. The
throws
is not needed in lockpick(). At some point in your solution you may want to put it, but neither at the start nor in the end. I fixed it, thanks.Marking as solved
lockpick
should bestatic
.I don't agree. I think it's the Burglar who lockpicks, so the functionality should belong to an instance Burglar, and not be available externally as a static utility method. For example, if a burglar had a
skill
level, thelockpick()
could depend on it's skill. It's not this case, but it could be possible. Why do you think it should be static?So you're saying that
lockpick
should be an instance method because if theBurglar
class actually had instance-specific code, even though IT DOES NOT HAVE ANY, it would not be possible to make itstatic
? Is this a joke?First of all, there is no need to shout. Second, it is technically possible to make it static, but functionally it is not correct. Because it is the burglar who lockpicks.
new Burglar().lockpick()
andBurglar.lockpick()
they both work. But in the first case there is a Burglar who lockpicks; in the second case it's a functionality that anyone can call, without being a Burglar. I want only burglars to be able to lockpick. So from my point of view it's technical vs functional. Exercise-wise, it makes no difference, so let's leave it as it is.Lack of description. What would expected behavior be when a bad code gets chosen when the chest is already open, and does such further attempts even make sense?
I updated the description with
Once open, the chest will stay open.
. It should be enough(?) Thanks for the feedback.marking as solved