Ad
  • Custom User Avatar

    Go preloaded tests are not quite right. It doesn't correctly pick up the set variables clues and expected. I assume because the examples run after all lines of the Describe are evaluated, so the way it's done it only runs with last clues and examples. Could we move setting these variables inside the It?

    var _ = Describe("Sky Scraper", func() {
      
      It("can solve 6x6 puzzle 1", func() {
        clues := []int{ 3, 2, 2, 3, 2, 1,
              1, 2, 3, 3, 2, 2,
              5, 1, 2, 2, 4, 3,
              3, 2, 1, 2, 2, 4}
              
        expected := [][]int{{ 2, 1, 4, 3, 5, 6 },
                { 1, 6, 3, 2, 4, 5 },
                { 4, 3, 6, 5, 1, 2 },
                { 6, 5, 2, 1, 3, 4 },
                { 5, 4, 1, 6, 2, 3 },
                { 3, 2, 5, 4, 6, 1 }}
    
          Expect(SolvePuzzle(clues)).To(Equal(expected))
      })
      
      It("can solve 6x6 puzzle 2", func() {
        clues := []int{ 0, 0, 0, 2, 2, 0, 0, 0, 0, 6, 3, 0, 0, 4, 0, 0, 0, 0, 4, 4, 0, 3, 0, 0}
        expected := [][]int{{ 5, 6, 1, 4, 3, 2 },  { 4, 1, 3, 2, 6, 5 }, { 2, 3, 6, 1, 5, 4 }, 
                { 6, 5, 4, 3, 2, 1 }, { 1, 2, 5, 6, 4, 3 }, { 3, 4, 2, 5, 1, 6 }}            
    
        Expect(SolvePuzzle(clues)).To(Equal(expected))
      })
      
       It("can solve 6x6 puzzle 3", func() {
         clues := []int{ 0, 3, 0, 5, 3, 4, 0, 0, 0, 0, 0, 1, 0, 3, 0, 3, 2, 3, 3, 2, 0, 3, 1, 0}
         expected := [][]int{{ 5, 2, 6, 1, 4, 3 }, { 6, 4, 3, 2, 5, 1 }, { 3, 1, 5, 4, 6, 2 }, 
                { 2, 6, 1, 5, 3, 4 }, { 4, 3, 2, 6, 1, 5 }, { 1, 5, 4, 3, 2, 6 }}
    
         Expect(SolvePuzzle(clues)).To(Equal(expected))
       })
    })
    
  • Custom User Avatar

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

  • Custom User Avatar

    This has confusing instructions. I don't mind the chessboard story or what's there but what's missing. There should be some explanation that you expect the results in a rational representation. It shouldn't be a guesswork that the returned array represents a rational number. I did go, and []int is not a natural way to express rationals.

    ok admittedly I haven't read the instructions for other languages which have a hint. I rephrase the suggestion as mentioning this as a language independent requirement at the top.

  • Custom User Avatar

    kata hint != kata suggestion

  • Custom User Avatar

    Seems to be fixed.

  • Default User Avatar

    If n is given the iterator yields n values and then closes.

    Then why, in the test case with a set, the expected size of the set is 5?

    first yielded value => {}

    second yielded value => {0}

    third yielded value => {0, 1}

    fourth yielded value => {0, 1, 2}

    fifth yielded value => {0, 1, 2, 3}

    It yields 5 values and closes. Then why is the expected set {0, 1, 2, 3, 4}?

  • Custom User Avatar

    Error messages in javascript are useless:

    expected        [ 'str', 'strstr', 'strstrstrstr' ] 
    to deeply equal [ 'str', 'strstr', 'strstrstrstr' ]
    
  • Custom User Avatar

    same here: expected 1 to equal 1 WTF is this in JS?

  • Custom User Avatar

    Fixed test only tests queen promotion and en-passant by black.

    Worse, random tests doesn't even test en-passant, so en-passant by white is never tested at all.

  • Custom User Avatar

    Square and Move should really be defined in Preloaded and not by user code.

  • Custom User Avatar

    Is it really a requirement for parentheses to be acknowledged if the result doesn't change?

    (ab)a is the same regex as aba (in this scenario).

    Why do the random tests expect (ab)a instead of aba?

  • Custom User Avatar

    The random strings tests are borked - it expects nonempty results for clearly invalid expressions (eg. a trailing | ).
    The solution is to just repeatedly attempt until the random strings pass... So I don't really see the point of these random string tests?

  • Default User Avatar

    Bad "random_strings" test:

    parse '(|(9?iXZVg"))' = '' shouldBe '(|(9?iXZVg"))'

    You can see after the first ( there is a |. Empty string is not a valid regexp (in this kata), so '' is the correct result.

  • Custom User Avatar

    Very (very very) nice kata :-)
    Actually tried a lot of complex methods, at the end writing a dedidated simple parser gave the best results.
    Note: had to write all the provided RegExp* methods, including the pretty print, for debugging in my MSVC...

  • Custom User Avatar

    If you have return, it is an explicit return which can be at any point in a method, but the last expression of any method is always returned as an implicit return, so no return is ever needed for the last expression in a Ruby method.

  • Loading more items...