************************************************ * EXAMPLE OF SOLVING THE BOARD3.TXT GAME BOARD * ************************************************ bash-4.1$ python proj3.py This program allows you to play Minesweeper. The object of the game is to flag every mine, using clues about the number of neighboring mines in each field. To win the game, flag all of the mines (and don't incorrectly flag any non-mine fields). Good luck! Enter the file to load the board from: board3.txt 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . . . . . . . . . + 2 + . . . . . . . . . + 3 + . . . . . . . . . + 4 + . . . . . . . . . + 5 + . . . . . . . . . + 6 + . . . . . . . . . + 7 + . . . . . . . . . + 8 + . . . . . . . . . + 9 + . . . . . . . . . + + + + + + + + + + + + There are 10 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 4 Please choose the column: Enter a number between 1 and 9 (inclusive): 1 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: r 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . . 1 1 . . . . + 2 + 1 1 1 1 1 . . . + 3 + 1 . . . + 4 + 1 . . . + 5 + 1 . . . + 6 + 1 1 1 . . . + 7 + 1 . . . . . + 8 + 1 1 1 2 . . . . . + 9 + . . . . . . . . . + + + + + + + + + + + + There are 10 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 1 Please choose the column: Enter a number between 1 and 9 (inclusive): 2 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: f 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 . . . . + 2 + 1 1 1 1 1 . . . + 3 + 1 . . . + 4 + 1 . . . + 5 + 1 . . . + 6 + 1 1 1 . . . + 7 + 1 . . . . . + 8 + 1 1 1 2 . . . . . + 9 + . . . . . . . . . + + + + + + + + + + + + There are 9 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 7 Please choose the column: Enter a number between 1 and 9 (inclusive): 5 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: f 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 . . . . + 2 + 1 1 1 1 1 . . . + 3 + 1 . . . + 4 + 1 . . . + 5 + 1 . . . + 6 + 1 1 1 . . . + 7 + 1 F . . . . + 8 + 1 1 1 2 . . . . . + 9 + . . . . . . . . . + + + + + + + + + + + + There are 8 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 1 Please choose the column: Enter a number between 1 and 9 (inclusive): 6 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: f 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F . . . + 2 + 1 1 1 1 1 . . . + 3 + 1 . . . + 4 + 1 . . . + 5 + 1 . . . + 6 + 1 1 1 . . . + 7 + 1 F . . . . + 8 + 1 1 1 2 . . . . . + 9 + . . . . . . . . . + + + + + + + + + + + + There are 7 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 4 Please choose the column: Enter a number between 1 and 9 (inclusive): 9 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: r 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F . . . + 2 + 1 1 1 1 1 . 1 1 + 3 + 1 . 1 + 4 + 1 . 1 + 5 + 1 . 1 + 6 + 1 1 1 . 1 1 + 7 + 1 F . . . . + 8 + 1 1 1 2 . . . . . + 9 + . . . . . . . . . + + + + + + + + + + + + There are 7 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 9 Please choose the column: Enter a number between 1 and 9 (inclusive): 9 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: r 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F . . . + 2 + 1 1 1 1 1 . 1 1 + 3 + 1 . 1 + 4 + 1 . 1 + 5 + 1 . 1 + 6 + 1 1 1 . 1 1 + 7 + 1 F . . . . + 8 + 1 1 1 2 . . 3 1 1 + 9 + . . . . . . 2 + + + + + + + + + + + + There are 7 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 7 Please choose the column: Enter a number between 1 and 9 (inclusive): 6 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: r 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F . . . + 2 + 1 1 1 1 1 . 1 1 + 3 + 1 . 1 + 4 + 1 . 1 + 5 + 1 . 1 + 6 + 1 1 1 . 1 1 + 7 + 1 F 2 . . . + 8 + 1 1 1 2 . . 3 1 1 + 9 + . . . . . . 2 + + + + + + + + + + + + There are 7 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 6 Please choose the column: Enter a number between 1 and 9 (inclusive): 7 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: r 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F . . . + 2 + 1 1 1 1 1 . 1 1 + 3 + 1 . 1 + 4 + 1 . 1 + 5 + 1 . 1 + 6 + 1 1 1 1 1 1 + 7 + 1 F 2 . . . + 8 + 1 1 1 2 . . 3 1 1 + 9 + . . . . . . 2 + + + + + + + + + + + + There are 7 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 7 Please choose the column: Enter a number between 1 and 9 (inclusive): 7 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: r 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F . . . + 2 + 1 1 1 1 1 . 1 1 + 3 + 1 . 1 + 4 + 1 . 1 + 5 + 1 . 1 + 6 + 1 1 1 1 1 1 + 7 + 1 F 2 2 . . + 8 + 1 1 1 2 . . 3 1 1 + 9 + . . . . . . 2 + + + + + + + + + + + + There are 7 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 8 Please choose the column: Enter a number between 1 and 9 (inclusive): 6 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: f 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F . . . + 2 + 1 1 1 1 1 . 1 1 + 3 + 1 . 1 + 4 + 1 . 1 + 5 + 1 . 1 + 6 + 1 1 1 1 1 1 + 7 + 1 F 2 2 . . + 8 + 1 1 1 2 . F 3 1 1 + 9 + . . . . . . 2 + + + + + + + + + + + + There are 6 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 7 Please choose the column: Enter a number between 1 and 9 (inclusive): 8 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: f 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F . . . + 2 + 1 1 1 1 1 . 1 1 + 3 + 1 . 1 + 4 + 1 . 1 + 5 + 1 . 1 + 6 + 1 1 1 1 1 1 + 7 + 1 F 2 2 F . + 8 + 1 1 1 2 . F 3 1 1 + 9 + . . . . . . 2 + + + + + + + + + + + + There are 5 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 8 Please choose the column: Enter a number between 1 and 9 (inclusive): 5 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: r 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F . . . + 2 + 1 1 1 1 1 . 1 1 + 3 + 1 . 1 + 4 + 1 . 1 + 5 + 1 . 1 + 6 + 1 1 1 1 1 1 + 7 + 1 F 2 2 F . + 8 + 1 1 1 2 4 F 3 1 1 + 9 + . . . . . . 2 + + + + + + + + + + + + There are 5 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 9 Please choose the column: Enter a number between 1 and 9 (inclusive): 6 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: f 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F . . . + 2 + 1 1 1 1 1 . 1 1 + 3 + 1 . 1 + 4 + 1 . 1 + 5 + 1 . 1 + 6 + 1 1 1 1 1 1 + 7 + 1 F 2 2 F . + 8 + 1 1 1 2 4 F 3 1 1 + 9 + . . . . . F 2 + + + + + + + + + + + + There are 4 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 7 Please choose the column: Enter a number between 1 and 9 (inclusive): 9 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: r 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F . . . + 2 + 1 1 1 1 1 . 1 1 + 3 + 1 . 1 + 4 + 1 . 1 + 5 + 1 . 1 + 6 + 1 1 1 1 1 1 + 7 + 1 F 2 2 F 1 + 8 + 1 1 1 2 4 F 3 1 1 + 9 + . . . . . F 2 + + + + + + + + + + + + There are 4 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 2 Please choose the column: Enter a number between 1 and 9 (inclusive): 7 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: r 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F . . . + 2 + 1 1 1 1 1 2 1 1 + 3 + 1 . 1 + 4 + 1 . 1 + 5 + 1 . 1 + 6 + 1 1 1 1 1 1 + 7 + 1 F 2 2 F 1 + 8 + 1 1 1 2 4 F 3 1 1 + 9 + . . . . . F 2 + + + + + + + + + + + + There are 4 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 1 Please choose the column: Enter a number between 1 and 9 (inclusive): 7 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: r 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F 2 . . + 2 + 1 1 1 1 1 2 1 1 + 3 + 1 . 1 + 4 + 1 . 1 + 5 + 1 . 1 + 6 + 1 1 1 1 1 1 + 7 + 1 F 2 2 F 1 + 8 + 1 1 1 2 4 F 3 1 1 + 9 + . . . . . F 2 + + + + + + + + + + + + There are 4 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 1 Please choose the column: Enter a number between 1 and 9 (inclusive): 8 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: f 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F 2 F . + 2 + 1 1 1 1 1 2 1 1 + 3 + 1 . 1 + 4 + 1 . 1 + 5 + 1 . 1 + 6 + 1 1 1 1 1 1 + 7 + 1 F 2 2 F 1 + 8 + 1 1 1 2 4 F 3 1 1 + 9 + . . . . . F 2 + + + + + + + + + + + + There are 3 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 3 Please choose the column: Enter a number between 1 and 9 (inclusive): 7 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: r 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F 2 F . + 2 + 1 1 1 1 1 2 1 1 + 3 + 1 1 1 + 4 + 1 . 1 + 5 + 1 . 1 + 6 + 1 1 1 1 1 1 + 7 + 1 F 2 2 F 1 + 8 + 1 1 1 2 4 F 3 1 1 + 9 + . . . . . F 2 + + + + + + + + + + + + There are 3 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 4 Please choose the column: Enter a number between 1 and 9 (inclusive): 7 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: f 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F 2 F . + 2 + 1 1 1 1 1 2 1 1 + 3 + 1 1 1 + 4 + 1 F 1 + 5 + 1 . 1 + 6 + 1 1 1 1 1 1 + 7 + 1 F 2 2 F 1 + 8 + 1 1 1 2 4 F 3 1 1 + 9 + . . . . . F 2 + + + + + + + + + + + + There are 2 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 5 Please choose the column: Enter a number between 1 and 9 (inclusive): 7 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: r 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F 2 F . + 2 + 1 1 1 1 1 2 1 1 + 3 + 1 1 1 + 4 + 1 F 1 + 5 + 1 1 1 + 6 + 1 1 1 1 1 1 + 7 + 1 F 2 2 F 1 + 8 + 1 1 1 2 4 F 3 1 1 + 9 + . . . . . F 2 + + + + + + + + + + + + There are 2 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 9 Please choose the column: Enter a number between 1 and 9 (inclusive): 5 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: f 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F 2 F . + 2 + 1 1 1 1 1 2 1 1 + 3 + 1 1 1 + 4 + 1 F 1 + 5 + 1 1 1 + 6 + 1 1 1 1 1 1 + 7 + 1 F 2 2 F 1 + 8 + 1 1 1 2 4 F 3 1 1 + 9 + . . . . F F 2 + + + + + + + + + + + + There are 1 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 9 Please choose the column: Enter a number between 1 and 9 (inclusive): 5 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: f 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F 2 F . + 2 + 1 1 1 1 1 2 1 1 + 3 + 1 1 1 + 4 + 1 F 1 + 5 + 1 1 1 + 6 + 1 1 1 1 1 1 + 7 + 1 F 2 2 F 1 + 8 + 1 1 1 2 4 F 3 1 1 + 9 + . . . . . F 2 + + + + + + + + + + + + Flag removed from 9, 5 There are 2 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 9 Please choose the column: Enter a number between 1 and 9 (inclusive): 5 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: r 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F 2 F . + 2 + 1 1 1 1 1 2 1 1 + 3 + 1 1 1 + 4 + 1 F 1 + 5 + 1 1 1 + 6 + 1 1 1 1 1 1 + 7 + 1 F 2 2 F 1 + 8 + 1 1 1 2 4 F 3 1 1 + 9 + . . . . 3 F 2 + + + + + + + + + + + + There are 2 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 9 Please choose the column: Enter a number between 1 and 9 (inclusive): 4 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: f 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F 2 F . + 2 + 1 1 1 1 1 2 1 1 + 3 + 1 1 1 + 4 + 1 F 1 + 5 + 1 1 1 + 6 + 1 1 1 1 1 1 + 7 + 1 F 2 2 F 1 + 8 + 1 1 1 2 4 F 3 1 1 + 9 + . . . F 3 F 2 + + + + + + + + + + + + There are 1 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 9 Please choose the column: Enter a number between 1 and 9 (inclusive): 3 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: r 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F 2 F . + 2 + 1 1 1 1 1 2 1 1 + 3 + 1 1 1 + 4 + 1 F 1 + 5 + 1 1 1 + 6 + 1 1 1 1 1 1 + 7 + 1 F 2 2 F 1 + 8 + 1 1 1 2 4 F 3 1 1 + 9 + . . 1 F 3 F 2 + + + + + + + + + + + + There are 1 mines left to find Please choose the row: Enter a number between 1 and 9 (inclusive): 9 Please choose the column: Enter a number between 1 and 9 (inclusive): 1 Enter 'r' to reveal the space, or enter 'f' to mark the space with a flag: f 1 2 3 4 5 6 7 8 9 + + + + + + + + + + + 1 + . F 1 1 F 2 F . + 2 + 1 1 1 1 1 2 1 1 + 3 + 1 1 1 + 4 + 1 F 1 + 5 + 1 1 1 + 6 + 1 1 1 1 1 1 + 7 + 1 F 2 2 F 1 + 8 + 1 1 1 2 4 F 3 1 1 + 9 + F . 1 F 3 F 2 + + + + + + + + + + + + You won! Congratulations, and good game!