def battleship(): while turn < 4: print_board(board) guess_row = int(raw_input("Guess Row:")) guess_col = int(raw_input("Guess Col:")) print "Turn", turn + 1 print "Ship Row: %s" % (ship_row) print "Ship Col: %s" % (ship_col) if guess_col == ship_col and guess_row == ship_row: print "Congratulations! You sank my battleship!" break elif board[guess_row][guess_col] == "X": print "You guessed that one already." elif guess_row not in range(5) or guess_col not in range(5): print "Oops, that's not even in the ocean." elif board[guess_row][guess_col] != "X": print "You missed my battleship!" board[guess_row][guess_col] = "X" else: print "Game Over" break battleship()
My problem is in the very beginning of the while loop, it's not adding 1 to turn at each iteration of the loop. It simply prints turn and adds 1 once, each time as if it were the first instance. So my game won't break unless I successfully sink my battleship, otherwise everything else works as its supposed to.
Am I using my while loop incorrectly?