6 kyu
Finding Arrows in a String
247 of 394skidd
Loading description...
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.
Nice kata to exercise pattern matching with.
I am asking this as a question, since I don't know if I have missed something or there is an unclear specification: how should be treated
=<=>
? Two valid arrows (=<
and=>
) or a sequence of value 0 (=
-> 0 +<=>
-> double ended arrow, so 0 two),an arrow has a head,
'>'
or'<'
, and optionally a tail, that must be located opposite to where the arrowhead is pointing; so=<
is a lone=
followed by a leftwards arrow of size 1. It is true that it is not explicitely specifiedOh sure, you're right. It's obvious, I have been fooled by an error in my code. Thanks for answering :)
The initial Test works, but the Attempt always fails and I am not able to decipher what could be wrong. By all my best knowledge: I coded my solution exactly according to the written description - hence the Test works fine.
It would be helpful if the StackTrace contained also the inputs, not just the output and expected output. This way we are kept too much in dark, I only see: testAdvanced()
expected: <-2> but was: <4>
testRandom()
expected: <33> but was: <34>
expected: <42> but was: <44>
... and many other different combinations.
Would it be possible to display the input values of the testAdvanced(), so that I would see that maybe I am missing something from the Description ?
Just because you think you covered every case, doesn't mean it's true :P
You can print input values as shown here https://docs.codewars.com/training/troubleshooting/#print-input (Python example, but printing to console works for every language)
As it stands, this isn't a kata issue, but a question (until proven otherwise).
How to calculate this ? '>===>->' == [>] [==>] [->] -> 9 Do I make mistake somewhere ?
Can someone explain how is this input
>>><.=<=<..=<>
-3. I'm still getting -9. thanksHello, your issue may be how you process the dots in the string. Instead of empty characters, you should see them as breaks or spaces.
In this case you get for
>>><.=<=<..=<>
:yes, that was it. thx
The string will only contain the characters ., -, =, <, >. assertEquals(11, ArrowSearch.searchArrows("-1")); how I need to understand this?
I don't see this test. Where did you find it?
java test
C translation ⟶⟾
Looks good
at least in Python, there are no fixed / sample tests with
=
and-
being adjacent, e.g.:<---===
<-=-=->
Java translation
Approved!
I updated the solution, it contained an error. Also added a fixed sample test to cover the issue. Please check and approve! Sorry for the inconvinience!
Rust translation
Approved!
IMHO You should append the description: seems that in your tests the tail length is caped to 2 max (==) or some value and couldn't see that in the description..
Thus I coded for any length of arrow, such as "<===========".
Also give some hints regarding the tests size (small/medium/large)
This comment has been hidden.
Thank you for your suggestion, I added some fixed tests with longer arrows.
C++ translation
Approved!
Actual tests should at least contain every sample test. Currently it consists of a completely different set of tests.
Also, the fixed tests in actual tests do not have a mixture of arrows and
.
together. They only exists in random tests.Thanks for the feedback, this is now fixed.
Random tests do not have the correct testing framework usage (about
describe
andit
): See https://docs.codewars.com/languages/python/codewars-testI changed the random tests to use
it
.Initial code has
arrow_game
but sample tests hasarrow_search
. Which one is correct?Thanks for catching this. I now changed the name of the initial code to
arrow_search
.