Exemplo n.º 1
0
first_turn = True

print("Starting Game")
minesweeper.reveal()
print("========================")
minesweeper.show()
print("========================")

# Game Loop
while True:

    try:
        # Get Move from player
        # target_cell   : Cell or tuple(row, column)
        # is_flag       : Boolean
        target_cell, is_flag = player.get_move(minesweeper)

        # Print chosen action
        if isinstance(target_cell, Cell):
            i, j = minesweeper.get_cell_coord(target_cell)
        else:
            i, j = target_cell

        print("Action Chosen : ({}, {}) , Flag : {}".format(i, j, is_flag))
        if first_turn:
            print("First Move")

        # Apply Action
        # Result is Boolean : True = blew up a mine , False = you're fine
        try:
            minesweeper.player_action(target_cell, is_flag, first_turn)