Ad
  • Custom User Avatar

    This isnt the point here, the clever votes was just because it's really a funny way to not resolve the problem but pass all tests. you're just so serious to understand.

  • Custom User Avatar
  • Custom User Avatar

    The kata was made with a standard Connect Four setup in mind, and nobody's going to change the requirements now.

  • Custom User Avatar

    There is a carriage return after some chars, so we have 2 lines.
    The empty string is indeed considered as 0 line. I can feel your confusion.
    I can see your logic but it wouldn't make sense to dismiss empty lines. Imagine a text with empty lines in the middle, it would be weird to skip them!
    I see it as a very specific case: empty string = absolutely nothing. Not even a single char to consume. It would be weird to use a text parser for an empty block of text.
    The way i see it:

    • Empty string = 0 line
    • At least one char = a line
    • Increase line count for each carriage return seen

    I suppose the kata wasn't overrly specific about that, but I'm sure you managed to fix it with the test cases.

    It reminds me of something somewhat related:
    If you look for "" (empty string) in a string [see .indexOf() implementations], at which position do you find it?
    At the beginning, the end, between each charcater, none?

    Cheers