Ad
  • Custom User Avatar

    Poker question no. 1:
    it("Highest pair wins", function() { assert(Result.loss, "6S AD 7H 4S AS", "AH AC 5H 6H 7S");});

    --> Is this an error in the test cases? (the pair is equal: both have a pair of aces)

    --> Is this saying that only in case of an equal pair, the suit is relevant? (clubs beats spades)

    --> Is this saying that in case of an equal pair, the highest card is deciding? (5 beats 4)

  • 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

    image is broken in the description.

  • Custom User Avatar

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

  • Custom User Avatar

    Python (probably other languages also) too: modifying input can influence the random tests: see this

  • Custom User Avatar

    [Python]

    Random tests are full of cheaters, e.g.:

    Failed at test 32: '7C 7S 3S 7H 5S' against '7C 7S KH 2H 7H': 'Tie' should equal 'Loss'
    

    There can't be two "three of a kind" with the same cards.

  • Default User Avatar

    My solution passed, but does not work properly:
    my hand "7C 7S 2S 2H AH" wins against "KC KH 5D QS QC".

    A test is missing for this case I guess.

  • Custom User Avatar

    This kata is a candidate for retirement as broken: https://github.com/codewars/content-issues/issues/205

    Please share your opinion how to handle this broken kata: retire? fix? Something else?

  • Default User Avatar

    I solved it using python and 7 basic tests pass without a problem, but at "Random coordinates" attempt I get a message "None should equal '11'". Could someone help me understand why this is happening?

  • Default User Avatar

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

  • Custom User Avatar

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

  • Default User Avatar

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

  • Custom User Avatar

    my barbaric Python solution takes ~.3sec/puzzle on my machine, passes sample tests. But it fails all 16 random tests, taking ~9.5 sec to do so. Interestingly, the stderr output reads:
    ((), (), (), ()) should equal ((1, 3, 4, 2), (4, 2, 1, 3), (3, 4, 2, 1), (2, 1, 3, 4))
    when I plug the result into solution, my puzzle solver solves it correctly.

    What might be going on here? Too sloooooow or am I missing something else? 🤔

  • Custom User Avatar

    In the JavaScript version empty classes pass the tests

  • Custom User Avatar

    I'm using random.NextDouble()-0.5 the shuffle a list. This should work, wouldn't you agree?
    Is it a hidden requirement to use Next only?

  • Loading more items...