• 'Moore Neighborhood': Precondition violated

 

I would like to give some feedback about 'Moore Neighborhood'.

Precondition states:

all(len(grid[0]) == len(row) for row in grid)

which means, it's a square grid, if I am not mistaken. Yet the test 4/4 gives me:

сount_neighbours(
    ((1,0,1,0,1),
    (0,1,0,1,0),
    (1,0,1,0,1),
    (0,1,0,1,0),
    (1,0,1,0,1),
    (0,1,0,1,0),), 5, 4)

which results in an IndexError exception in my program, because it was build with the assumption of a square grid. Anyway, I can change my program to solve the mission, but either the tests need to be changed or the precondition. ;)

Best regards. Peter.White

From: http://www.checkio.org/mission/count-neighbours/solve/

HTTP_USER_AGENT:

Mozilla/5.0 (X11; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0