#NEWLINE# def generate_bombs( self ) : #NEWLINE# #INDENT# bombs = self . sample ( xrange ( self . squares ) , ( self . no_of_bomb + 1 ) ) #NEWLINE# ( row , column ) = ( self . row , self . column ) #NEWLINE# for ( i , bomb ) in enumerate ( bombs ) : #NEWLINE# #INDENT# x = ( bomb // column ) #NEWLINE# y = ( bomb % column ) #NEWLINE# mine = self . grid . getCell ( x , y ) #NEWLINE# if ( i == 0 ) : #NEWLINE# #INDENT# self . extra_mine = mine #NEWLINE# continue #NEWLINE# #UNINDENT# self . bombed_cells . append ( mine ) #NEWLINE# mine . count = ( - 1 ) #NEWLINE# for one in self . get_neighbors ( mine ) : #NEWLINE# #INDENT# if ( one . count != ( - 1 ) ) : #NEWLINE# #INDENT# one . count += 1