Minesweeper says it is making a safe move but chooses a mine. It also makes random moves even though there are safe moves it can make. I don't know why it does that. This is the link to my code below.
Also, Pygame hangs after a few moves, I'm not sure if this is because of a bug in my code or if my computer was handling too many things at once. I think it is the latter. However if anyone sees a bug in my code, please help me