I have a minelist[0,15] for a board 4 height and 4 width every elemnt in the board is a zero so it looks like [['0','0','0', '0'],['0','0','0', '0'],['0','0','0', '0'],['0','0','0','0']]now if I mines X in 0,15 it would look like [['x','0','0', '0'],['0','0','0', '0'],['0','0','0', '0'],['0','0','0','x']] now whereever the mines are touching it is incremented by one using a counter the final board looks like [['x','1','0', '0'],['1','1','0', '0'],['0','0','1', '1'],['0','0','1','x']]

I created the board of zeros but I have no idea to how to put the mines and get the final board please coul i get any suggestions or help.
Thank you

You don't have a [0, 15] in the example you posted, you have [0, 0] through [3, 3]. If you have a
board = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] --> 16 zeros
then you can access the 15th. Show us some code, especially the code that creates the board, for more info.

def make_grid(minelist, width, height):

grid, i = [], 0
for row in xrange(height):
    row_list = []
    for col in xrange(width):
        row_list.append('x' if i in minelist else '0')
        i += 1
    grid.append(row_list)
    print row_list

    this creates the zero board and adds mines specified at the right index places like 0,15 but I dont kknow how to increment all the neighboring tiles of mine to 1.

Continuing on with the code you posted `

for row in xrange(height):
    for col in xrange(width):
         print row, col   
    print

This will print what is available. As you can see there is no 15 so it is impossible to change 15. First, check the input to see that it is not outside the range of the board. Then come up with a function to change a space based upon arguments passed to the function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.