コード例 #1
0
def test_neighbors_edge_right_bot():
    empty_matrix = numpy.zeros([3, 3])
    valued_matrix = calculate_neighbors_given_a_bomb(empty_matrix, 2, 2)

    assert valued_matrix.tolist() == [[0, 0, 0],
                                      [0, 1, 1],
                                      [0, 1, 0]]
コード例 #2
0
def test_neighbors_edge_mid_mid():
    empty_matrix = numpy.zeros([3, 3])
    valued_matrix = calculate_neighbors_given_a_bomb(empty_matrix, 1, 1)

    assert valued_matrix.tolist() == [[1, 1, 1],
                                      [1, 0, 1],
                                      [1, 1, 1]]
コード例 #3
0
def test_bombs_dont_get_changed():
    empty_matrix = numpy.zeros([3, 3])
    empty_matrix[0, 0] = BOMB
    valued_matrix = calculate_neighbors_given_a_bomb(empty_matrix, 1, 0)

    assert valued_matrix.tolist() == [[BOMB, 1, 0],
                                      [0,    1, 0],
                                      [1,    1, 0]]