Ejemplo n.º 1
0
 def test_query_time_elapsed(self):
     minesweeper = Minesweeper()
     minesweeper.new_game()
     self.assertEqual(minesweeper.time_elapsed(), 0)
Ejemplo n.º 2
0
        result = ''
        result += str(vertical_index)
        for col in row:
            result += horizontal_padding
            result += str(col)
        print(result)


minesweeper = Minesweeper()
minesweeper.new_game()
print('Welcome to Minesweeper')
print_commands()
while minesweeper.status() == 'Playing':
    print('Game Status:', minesweeper.status())
    print('Mines left:', minesweeper.mines_remaining())
    print('Time Elapsed:', minesweeper.time_elapsed())
    pretty_print_board(minesweeper.view_board())
    process_input(input())

if minesweeper.status() == 'Lose':
    pretty_print_board(minesweeper.view_board())
    print('Mines left:', minesweeper.mines_remaining())
    print('Time Elapsed:', minesweeper.time_elapsed())
    print('BOOM')

if minesweeper.status() == 'Win':
    pretty_print_board(minesweeper.view_board())
    print('You beat the game in', minesweeper.time_elapsed(), 'seconds')