I am currently doing an assignment towards making a minesweeper like game in python using classes. For the backbone of the assignment we are just meant to import the professors premade class and create our own main function to make the class operate. We are not allowed to see the code behind the class and simply have to go off what is described in each class.
the init method is described as constructing a game board that is a square with cells that are filled in by question mark images and has the parameters of (self,size). the hideMines method is hide mines on game board and return a bool indicating if that was successful and uses parameters (self,num). The last is a probe method which finds the closest cell to your mouse click and reveals its icon as well as returns a tuple showing the number of cells probed and the mines remaining and uses parameters (self,x,y).
At this point in my code, the board is created and once my prompt for hiding mines is entered, the middle cell on the board is automatically uncovered and clicking does nothing. My question is, what do I need to make the click properly uncover the icon given my little amount of info?
import turtle
import game
def main():
wn = turtle.Screen()
board = wn.numinput("Numeric Input", "Enter desired board size: ")
board = int(board)
mine = game.Game(board)
nummine = wn.numinput("Numeric Input", "Enter desired number of mines: ")
nummine = int(nummine)
mine.hideMines(nummine)
def closure():
(find,rem) = mine.probe(board,board)
if rem == 0:
over = wn.textinput("Text Input", "Would you like to play again? (Y)es or (N)o")
if over == 'Y':
main()
else:
turtle.bye()
s = wn.getscreen()
s.onscreenclick(closure())
main()