7 kyu
Bob's Treasure Map
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.
Some solutions consider lowercase characters as valid, but according to the description they aren't. Tests with lowercase
nsew
should be added.Needs a fixed test that has valid directions but expects
[0,0]
.Thanks for the feedback! I added said fixed test.
Returning different data types is a bad practice.
Thanks for the feedback! I changed all the cases so instead of returning false you have to return [] when the map is fake, hope that solves the issue and, if it doesn't, please let me know!
IMO
[0, 0]
would make more sense considering wrong directions already provide(0, 0)
change in coordinates for partially valid inputs. At least, it's not a boolean anymore.My reasoning for why I prefer [] over [0,0]:
If you have any other suggestions, I would be happy to consider them.
In that case
nil
would be a lot more appropriate as its' purpose is signifying the absence of value.I'd second FArekkusu about that. :)
Tho, there is another possibility: raise an exception.
Thanks for the idea! nil would indeed be perfect, for some reason I didn't think about it...