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)
    
  • Custom User Avatar

    In sample tests generation2 has 8 elements.
    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()? It seems like mistake in generation2 data. When I replaced generation2 input, all sample tests get passed.

    Given:

    generation2 = [
    	{'x':5,'y':4,'size':3},
    	{'x':8,'y':6,'size':15},
    	{'x':1,'y':4,'size':4},
    	{'x':2,'y':7,'size':9},
    	{'x':9,'y':0,'size':10},
    	{'x':3,'y':5,'size':4},
    	{'x':7,'y':2,'size':6},
    	{'x':3,'y':3,'size':2}]
    

    Corrected:

    generation2 = [
    	{'x':5,'y':4,'size':3},
      {'x':2,'y':4,'size':13},
      {'x':6,'y':4,'size':7},
      {'x':6,'y':2,'size':4},
      {'x':6,'y':1,'size':8},
    	{'x':8,'y':6,'size':15},
    	{'x':1,'y':4,'size':4},
    	{'x':2,'y':7,'size':9},
    	{'x':9,'y':0,'size':10},
    	{'x':3,'y':5,'size':4},
    	{'x':7,'y':2,'size':6},
    	{'x':3,'y':3,'size':5}]
    

    Can you check if mistake present in tests?
    Also I can't correct full (remote) tests, so I can't pass them.