Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
  • Profile pic

    This comment is hidden because it contains spoiler information about the solution

  • 45493372?s=100

    Hello!
    Can you explain what is " {}._ "?
    and " *_ "?

    Thank you!

  • 36211281?s=100

    Tests have been updated. Try to solve it now.

  • 36211281?s=100

    It's dirty! The reason that the answer was accepted is the omission of checking random elements in tests.

  • 7867810?s=100
  • 17622328?s=100

    Description updated with examples of paths invalidated by overlap/intersection.

  • 5924141?s=100

    i mostly put that there because i had no guarantee that the random test wouldn't end up placing an arrow on a border. i guess one in several trillion is kind of unlikely, though.

  • 7867810?s=100

    If an arrow somehow strikes exactly on the border of two sectors, the sector on the right takes precedence.

    What is 'right'?
    What if it is on the intersection of 50, 10 and 30?

    Since the behaviour is actually not tested.
    And different order of calculation will lead to different floating error.

    So you'd better change it to It is guaranteed arrows wont strike on border of sectors

  • 49681055?s=100

    Nice solution! Now reading about '$&')))) Thanks a lot!

  • 1063901?s=100

    Uppercase vowels also count, please update your solution if you want to pass

  • 13503267?s=100

    I think it's good now. Thanks everyone for the needed critique. Please let me know if it can be improved further.

    Changes: '*' is now '+', as suggested. As such, upon failure it requires a return of NULL, not an empty string, since it is not matching anything (as opposed to matching "zero" of something).

  • 14909989?s=100

    It doesn't make sense to have 'zebra'.match(/[^z]*/) return ebra because regex by the original definition always starts matching from the beginning of a string. Searching with a regex is simply implemented as "try to match this regex on every position starting from the left until a match is found", so the first match at (0, 0) aka '' is returned. It's also why a global regex matching will never return overlapping strings: when a match is found you continue from the end of the last matched position.

    And if you try to claim that for some definition of regex 'zebra'.match(/[^z]*/) should return ebra, you end up with a pile of problems: why should it match ebra and not , bra or ebr? What is the criteria and tiebreaking of choosing the result?

    Also, empty string and null are different results of a regex match: the former means a match that starts and ends at the exact same location, while the latter means there are no matches. They're completely different.

  • 7867810?s=100

    which makes use of regex

    When you try to make use of regex, you should use it correctly.
    Though it is implemented differently across domains, they all agree on what should /[^z]*/ match on zebra

    Kotlin

    Regex("[^z]*").find("zebra")?.value
    

    JS

    'zebra'.match(/[^z]*/)
    

    Python

    import re;re.match('[^z]*','zebra')
    

    i.e. An EMPTY string

    So, you should either

    • Change the expected result from 'ebra' to ''
    • Change all the * marks to +
    • Clearify that the patterns here is similar to Regex but they are totally different
  • 13503267?s=100

    I have updated the kata description to reflect that this find function does two things: 1) uses regular expressions to locate substrings, and 2) copies said substring to return. It may be better to present the kata not as primarily a regular expression demonstration, but a tokenizer function which makes use of regex. Does that seem fair?

  • 13503267?s=100

    Oh I see, let me look into it.

  • Loading more items...