Ad
  • Custom User Avatar

    The tests are correct.

    populate() method gets called and right after that test checks print_state() and expects 12 elements instead of 8. How count of elements may change without calling the move(), or how it can increase even with move()?

    Note the last few bullet points on the instructions:

    This method may be called multiple times on the same class instance

    If a new blob's position is already occupied by an existing blob, the two fuse into a single blob

    In the test case generation 1 has already been populated. Notice that the state of the board just before populate(generation2) gets called.

    blobs = Blobservation(10,8)
    blobs.populate(generation1)
    blobs.move()
    pf(blobs,[[0,6,1],[1,1,1],[1,6,2],[2,1,5],[2,6,7],[4,2,6],[6,7,3],[7,1,2],[7,4,4],[7,7,1],[8,7,3]])
    blobs.move(2)
    pf(blobs,[[0,6,7],[1,5,3],[2,2,6],[4,1,6],[6,1,2],[6,4,4],[6,6,7]])
    blobs.move(2)
    pf(blobs,[[2,4,13],[3,3,3],[6,1,8],[6,2,4],[6,4,7]])
    blobs.populate(generation2)