
The while() loop terminates when the user either wins or lose. Then the game is played till the user either wins (when the user never steps/clicks on a mine-containing cell) or lose (when the user steps/clicks on a mine-containing cell). So if you are afraid of losing then uncomment this function and then play ! We can cheat before playing (by knowing the positions of the mines) using the function – cheatMinesweepeer(). We also assign the moves using the function assignMoves() before playing the game. Once the level is chosen, the realBoard and myBoard are initialized accordingly and we place the mines in the realBoard randomly. This is done by passing one of the above in the function – chooseDifficultyLevel(). We can choose any level among – BEGINNER, INTERMEDIATE and ADVANCED. Throughout the game, realBoard remains unchanged whereas myBoard sees many changes according to the user’s move. We play our game in myBoard and realBoard stores the location of the mines.

So we can see that we don’t always have to click on all the cells not having the mines (total number of cells – number of mines) to win.If you click on a cell having no adjacent mines (in any of the surrounding eight cells) then all the adjacent cells are automatically cleared, thus saving our time.So we can do some logical guesses to figure out which cells have mines. When we click on a cell having adjacent mines in one or more of the surrounding eight cells, then we get to know how many adjacent cells have mines in them.Implementing Web Scraping in Python with BeautifulSoup.Python | Simple GUI calculator using Tkinter.Domain Name System (DNS) in Application Layer.Internet Protocol version 6 (IPv6) Header.Internet Control Message Protocol (ICMP).Program to remotely Power On a PC over the internet using the Wake-on-LAN protocol.

Finding cabs nearby using Great Circle Distance formula.

