Retired

Checkerboard Generation (retired)

413 of 1,062richardhsu
Description
Loading description...
Algorithms
Loops
Control Flow
Basic Language Features
Fundamentals
Conditional Statements
  • Please sign in or sign up to leave a comment.
  • hobovsky Avatar

    This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/82 Please join the discussion to share your opinions, and help us identify duplicate kata and retire them.

  • FArekkusu Avatar

    What We're Testing We're testing loops and conditionals and aiming at beginners. There are many ways of achieving the solution...

    The use of loops and conditions is not tested, and the last sentence is complete nonsense. This should be removed.

  • bestwebua Avatar

    Awesome kata, thanks!!!

  • andrewferk Avatar

    Why do all the solutions voted as "Best Practice" have an O(n^2) runtime when there are easy to understand solutions with O(n) runtime?

  • donaldsebleung Avatar

    Codewars Forums - Kata Best Practices - Have Full Code Coverage

    [JavaScript] While having 10 fixed assertions in the entire test suite is not that bad, it is still somewhat insufficient in preventing logically flawed and/or hardcoded solutions from passing. You should either (1) increase the total number of unique, distinct fixed assertions to at least 20 including edge cases or (2) write 100+ random tests as per standard Codewars practice and is generally preferred over just fixed tests.

  • jsmit032 Avatar

    So I have code that is doing a simular thing to other. Show the expected out and the instead got, appears to be the same. I believe it's because there's an extra new line at the end. However this only breaks when the size is an odd number. Works for checkerboard(8), but breaking on checkerboard(5). Not sure how to show anyone my code properly. Additionally, I've been researching how to remove the last occurance of a line break, but can't seem to find anything.

    Used .trim() on my return statement, but that didn't work.

  • mrosenberger Avatar

    The description states that "You can [not MUST or MUST NOT] leave a newline character at the end of the full checkerboard", however, the tests are unambiguous - they specifically require that a trailing newline character is present in the "size > 1" case, and that a trailing newline character is NOT present in the "size < 1" case. This resulted in some confusion for me.

  • nathanAlan Avatar

    What am I doing wrong here?

    Output: Should return single square for size of 1 and should be a red square. Expected: [r] , instead got: [r] Should return alternating squares. Expected: [r][b] [b][r] , instead got: [r][b] [b][r]

    Expected: [r][b][r] [b][r][b] [r][b][r] , instead got: [r][b][r] [b][r][b] [r][b][r]

  • Azuaron Avatar

    The last test header says:

    Should return single square for size of 1 and should be a red square.

    Even though it's testing boards size > 1

  • user578387 Avatar

    This comment has been hidden.

  • ZozoFouchtra Avatar

    The failure message is not clear enough when you forget the ending "\n".

    ( got something like :

    Expected: [r][b][r]
    [b][r][b]
    , instead got: [r][b][r]
    [b][r][b]
    

    ...which is a bit confusing )

  • wthit56 Avatar

    Pretty cool kata. Nice and simple, but gets you thinking. Not sure why you pretty much hand all the optimization ideas on a platter in the description, though; part of the fun is coming up with your own strategies for that side of things.

    As a personal preference, I tend to tweak the code so that it's just function name() { } instead of name = function() { };. Usually that works just fine, but with this kata it did not; why is that? Running the example test fixture worked fine with the function name() { } form.