Ad
  • Custom User Avatar

    Extremely clever. Delightful, elegant solution. I'm going to study it, it will teach me lots.

    Thank you

  • Custom User Avatar

    Very elegant solution, thanks for the lesson!

  • Custom User Avatar

    Thank you for making me notice that, besides showing me the possible allowed directions in the various parts of the track, the examples also limited the allowed 'pieces' (characters) I can encounter there. I have to refine my parsing routine... Back to work!
    Francesco

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

  • Custom User Avatar

    Thank you, Hobovsky! When I 'test' my solution, it passes all the game simulations but the last one.
    After that one test, my solution also passes the two "throw an error" tests.

    This game follows its rules in a strict sequence: if you miss a single step you will very probably miss all the
    following ones. I had some hard time in understanding all the subtle tricks of this kata, and maybe I still need to
    learn some of them. But if you can read the message I wrote, in which I posted a full trace of the program behaviour,
    you will be able to follow every part of it... and so I did, by hand, with pencil, paper and debugger!
    Well, it really doesn't seem to me it's a problem in my solution. My program follows strictly every rule I know of, and it succeeds in every test but this. I apologize with docgunthrop, but as far as I understand it seems a problem in the required output, not in my one!
    Ok, I am just a pupil, I have a lot yet to learn. But without some debugging from the teacher, I really can't go a single step further.
    Will you have some spare time and help me?

  • Custom User Avatar

    I don't know if my previous comments on this kata were too stupid, or too boring, to deserve an answer...
    but I believe that a good Sensei should provide new knowledge and maybe enlightenment to stupid and boring
    warriors like me. I am stuck. But my attempted solution behaves exactly as requested, as far as I know,
    so I can't see where I got it wrong. Sure, I could give up and learn from the other warriors' solutions,
    But I don't want to give up, I want to solve this puzzle. And I am pretty sure I almost solved it.
    Please help me!

  • Custom User Avatar

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

  • Custom User Avatar

    Sure,

    68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
    != 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86

    But if you shuffle the numbers in a string,

    "".join(sorted("".join([str(x) for x in range(68, 85+1)])))
    '001122334455666777777777778888888899'
    "".join(sorted("".join([str(x) for x in range(69, 86+1)])))
    '001122334455666777777777778888888899'

    ... you lose all differences. In those 'scrambled' strings, you'll find 99, 12 and 45, for example.
    What I mean is that there are shuffled strings containing 68 and 69 and 85 and 86, and the ones in your
    test are wonderful examples!

  • Custom User Avatar

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

  • Custom User Avatar

    I have changed my choice of width and height according to the images you placed in the Description (though I think I would have stated this choice in text) and almost all the tests compare OK. But the last one still fails, and I don't understand why.
    I drew on paper the board, and followed all the moves by hand. As far as I know, my solution follows all the rules, and all my
    blobs behave correctly. I also have placed (a LOT of) print() functions in my solution, so I could trace every single move:

    --------------------------------------
    Up to this point, all the example tests compare equal.
    Mine==Yours: [[2, 4, 9], [3, 3, 13], [3, 6, 9], [4, 4, 4], [5, 3, 4], [5, 4, 10], [6, 2, 6], [7, 2, 8], [7, 5, 15], [8, 1, 10]] 
    
    Performing 3 moves:
    ----- 1 -----
    Blob 3 3 ( 13 )  found one largest target at 2 4 ( 9 )
    Blob 7 2 ( 8 )  found  a single target at 6 2 ( 6 )
    Blob 2 4 ( 9 )  found  a single target at 4 4 ( 4 )
    Blob 5 4 ( 10 ) chose among: [(5, 3, (4,), 'P3'), (4, 4, (4,), 'P5')]
    Blob 7 5 ( 15 )  found one largest target at 5 4 ( 10 )
    Blob 3 6 ( 9 )  found  a single target at 4 4 ( 4 )
    Blob 8 1 ( 10 )  found  a single target at 7 2 ( 8 )
    Blob 6 2 ( 6 )  found  a single target at 5 3 ( 4 )
    
    Blob at 3 3 ... moved to 2 4
    Blob at 7 2 ... moved to 6 2
    Blob at 2 4 ... moved to 3 4
    Blob at 5 4 ... moved to 5 3
    Blob at 7 5 ... moved to 6 4
    Blob at 3 6 ... moved to 4 5
    Blob at 8 1 ... moved to 7 2
    Blob at 6 2 ... moved to 5 3
    Blobs list coalesced: new len = 8 new minsize = 4
    [[2, 4, 13], [3, 4, 9], [4, 4, 4], [4, 5, 9], [5, 3, 20], [6, 2, 8], [6, 4, 15], [7, 2, 10]]
    
    ----- 2 -----
    Blob 2 4 ( 13 )  found  a single target at 3 4 ( 9 )
    Blob 6 2 ( 8 )  found  a single target at 4 4 ( 4 )
    Blob 3 4 ( 9 )  found  a single target at 4 4 ( 4 )
    Blob 5 3 ( 20 )  found one largest target at 6 4 ( 15 )
    Blob 6 4 ( 15 )  found one largest target at 7 2 ( 10 )
    Blob 4 5 ( 9 )  found  a single target at 4 4 ( 4 )
    Blob 7 2 ( 10 )  found  a single target at 6 2 ( 8 )
    
    Blob at 2 4 ... moved to 3 4
    Blob at 6 2 ... moved to 5 3
    Blob at 3 4 ... moved to 4 4
    Blob at 5 3 ... moved to 6 4
    Blob at 6 4 ... moved to 7 3
    Blob at 4 5 ... moved to 4 4
    Blob at 7 2 ... moved to 6 2
    Blobs list coalesced: new len = 6 new minsize = 8
    [[3, 4, 13], [4, 4, 22], [5, 3, 8], [6, 2, 10], [6, 4, 20], [7, 3, 15]]
    
    ----- 3 -----
    Blob 3 4 ( 13 )  found  a single target at 5 3 ( 8 )
    Blob 4 4 ( 22 )  found one largest target at 3 4 ( 13 )
    Blob 6 4 ( 20 )  found one largest target at 7 3 ( 15 )
    Blob 7 3 ( 15 )  found  a single target at 6 2 ( 10 )
    Blob 6 2 ( 10 )  found  a single target at 5 3 ( 8 )
    
    Blob at 3 4 ... moved to 4 3
    Blob at 4 4 ... moved to 3 4
    Blob at 6 4 ... moved to 7 3
    Blob at 7 3 ... moved to 6 2
    Blob at 6 2 ... moved to 5 3
    Blobs list coalesced: new len = 5 new minsize = 13
    [[3, 4, 22], [4, 3, 13], [5, 3, 18], [6, 2, 15], [7, 3, 20]]
    
    Mine: [[3, 4, 22], [4, 3, 13], [5, 3, 18], [6, 2, 15], [7, 3, 20]] 
    Yours: [[4, 3, 22], [5, 3, 28], [5, 4, 9], [6, 2, 29]] 
    
    ------------------------------

    So, would you be so kind to tell me what's wrong now?
    Please reply... I'm stuck!

    Edit: I assume you can look at my current code; if you cannot, please let me know.
    I really want to understand what's happening, please reply!

  • Custom User Avatar

    This just uncovers a different issue, this time in the instructions.
    Nowhere is stated where in the Blobservation must be the square [0, 0] placed,
    nor if "the 12 position" means 'towards increasing y' or 'towards increasing x',
    or in some other direction, given that a mathematical object as this board has
    no obvious 'up' and 'down'.
    So I chose to put [0, 0] as the upper left corner, and drawing the 'board' on paper I
    happened to think at the "12" position as "towards decreasing y". From your answer (while I should find it in the instructions) I understand that your choices were different.

    """
    . 0  1  2  3  4  5  6  7  8  9 X
    0 .  .  .  .  .  .  .  .  .  .
    1 .  .  .  .  .  .  .  .  .  .
    2 .  .  .  .  .  .  .  .  .  .
    3 .  .  .  .  .  .  .  .  B  .     in this situation, position "12" means "towards [8, 0]"
    4 .  .  .  .  .  .  .  .  .  .     and clockwise [9, 6] comes before [5, 6]
    5 .  .  .  .  .  .  .  .  .  .
    6 .  .  .  .  .  T  .  .  .  T
    7 .  .  .  .  .  .  .  .  .  .
    Y
    """

    If your choice of "12" position means "towards [8, 7]" (to me it's downward), then [5, 6]
    does indeed come before [9, 6]... but I think this choice should be clearly stated.

  • Custom User Avatar

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

  • Custom User Avatar

    After passing the initial tests, every attempt gets an 'Execution Timed Out' error.
    How can I fix my solution, if I can't see what causes it to fail?
    I think this information should be given to the warrior, to enable his/her improvement.
    At least, I would like to know just what were the parameters given in the failing test, without the expected answer.

    I timed my solution with the initial tests, and it took less than 15 seconds for 100000 repetitions! I suspect that
    one or more of the "serious" tests makes my solution enter an infinite loop. But I cannot verify this suspect, without
    access to the failing test!

  • Custom User Avatar

    Ok, after having tried the examples I could determine that the word must be 'searched' in a list of unique words.
    Anyway, I still think this should be stated clearly in the instructions.

  • Loading more items...