Ad
  • Default User Avatar

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

  • Default User Avatar

    Uhm, I'm not sure if it's the right word to use "step" because it seems you are still confusing the "step" with the "resulting location on the board" - remember, your guess isn't "Was your x_th step = something" but rather "Is the piece currently at (location)".

    But yes the above walk through example seems to be on the right track if that's what you mean - you are trying to systematically rule out which move patterns may or may not have been used.

    And as you correctly identified previously, if you do this naively (combinatorially) you will need a very large number of guesses >>> 500, so you need to be smarter.

    Also, as your above example shows, it may actually be the case that you decide to guess each "step" (again - better to use the word location) more than once. For example, your own example leads to you guessing the location (10,10) more than once as part of your strategy.

  • Default User Avatar

    Hi @suuujuuus - first of all, thank you for your interest in this Beta kata.

    Most of what you said is correct - except for part b) : I think where you're confused (or maybe my description isn't clear enough) is that you don't have to deduce the full "move pattern" that the genius is using -- all you have to guess/find is one location at the right time/step.

    So you're not trying to guess e.g. that the genius is performing the move pattern [ (+1,-1), (+3,-99), (-5,-60) ] repeatedly - you are trying to "catch" the piece at one single correct location.

    That's why your solution list (of length 500) is therefore 500 2-tuples; each one is a location on the board, not a move pattern.

    Hence, to be clear, when you say:

    But how do I figure out if a single guess is correct, so I can build on that?

    you don't need to worry, as the kata will compare your solution list to the actual trajectory of each game, and as long as one single location guess is correct, you will win.

  • Custom User Avatar

    After each of the supervillain's moves, you must guess the location of where you think the chess piece currently is on the chessboard. If your guess correctly matches the current location of the piece, you win.

    You are guessing the current location of the piece after each time it was moved, not the moveset that was used.

    And the move of the piece will follow the unknow moveset.

  • Custom User Avatar

    "-" <* s

    ( or, equivalently, s *> "-" )

  • Custom User Avatar

    join (***) length == (***) length length

    length *** length == \ (xs,ys) -> (length xs,length ys)

    join functions as the W-combinator, W f x = f x x ( it's used here in the (->) r Monad ( Reader? ), which I think of as the Function Monad ). I don't even know how (***) works exactly; it's also used in some specific Arrow I guess ( well, of course it is ). It just works is all I know.

    I'll readily admit it adds very little but confusion. But it means I don't have to have length twice ( at the cost of just another function, which I have to import to boot. I said it doesn't add much ); it defines that length is applied to both tuple elements.

  • Custom User Avatar

    numLength has to be exact. There is no number with length 76 in the series.

  • Default User Avatar

    Fixed.

  • Custom User Avatar
    test/PowerSpec.hs:25:80: error:
        • Variable not in scope: ss :: [(a, a1)]
        • Perhaps you meant ‘ss'’ (line 29)
       |
    25 |     r = dropWhile (\(i,s) -> s ==0 || length (show s) < numDig ) $ take ordMax ss
       |                                                                                ^^
    

    This is the real problem. It's not with your code.

  • Custom User Avatar

    There is something wrong with testing.

    You can't delete your solution, but it'll be invalid once the tests get fixed.