Ad
  • Custom User Avatar

    Could someone explain to me how the line below works for the description?

    if 2 < len(cells & get_neighbours(x, y)) < 4 + ((x, y) in cells)

    from my understanding the above would match on 3 for a dead cell and 3 or 4 for a living cell but the description for the challenge dictates 3 for a dead cell and 2 or 3 for a living cell (not 3 or 4), would really appreciate if someone could help me figure out what I'm missing?

  • Custom User Avatar

    And sorry about the code formatting, not sure what the delimeters are here, please let me know and I'll edit

  • Custom User Avatar

    For clarity, the ones I mention taking 3-4 seconds are the given tests on the webpage, these ones in this case: import Test.Hspec
    import Test.QuickCheck

    import Josephus (josephus)

    spec :: Spec
    spec = do
    describe "josephus" $ do
    it "works with integers" $ do
    josephus [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 1 shouldBe [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    josephus [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 2 shouldBe [2, 4, 6, 8, 10, 3, 7, 1, 9, 5]

    it "works with strings" $ do
      josephus "CodeWars" 4 `shouldBe` "esWoCdra"
    
  • Custom User Avatar

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

  • Custom User Avatar

    Ahh, googling only returned splitAt, wish I had found splitOn