Ad
  • Default User Avatar

    Good Kata. If you don't know what to do here, check out "Simplexer" first, since it teaches you the basics of Expression Parsing.

  • Custom User Avatar

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

  • Custom User Avatar

    Go random tests are broken:

    Random tests
    With arr = [0 0 0 0 0 0 0 0], t = 3, k = 3
    Expected
        <int>: 55
    to equal
        <int>: 60
    

    You are given a certain array of positive and negative integers which elements occur only once (all of them different from 0)

  • Custom User Avatar

    There is some wording weirdness in the instructions. I would understand how a sequence of elements in this sense can be contigous - it would be a slice of the original array. Then non contigous would be when it's not a slice of the original array, ie it has one gap. There is no sensible definition for calling an element contigous which the description does as it's not a property of the element. I understand what it's trying to say though. I would reprhase the instructions. Also would explicitly explain that no joint pairs following the original array order are allowed.

  • Custom User Avatar

    This operates on arr in place. While it wasn't explicitly stated the function should operate on a copy, one could argue the return type only makes sense if the function operated on a copy.

  • Custom User Avatar

    Had to read some Parser Theory articles and make my first grammar for this kata! What do you think, does it looks good?

    OrExpr = SeqExpr ["|" SeqExpr]
    SeqExpr = ("(" OrExpr ")" ["*"] | Str)*
    Str = /^(?:[^*()|]+\*?)+/
    

    i used imaginary syntax though

  • 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.

  • Loading more items...