Game Over!

#1

Hi,

My codes seems to work but if i play the game and quessing the same coordinates, the code for "You guessed that one already." doesn´t seem to work!

WHY?

``````# Everything from here on should go in your for loop!
for turn in range(4):# Be sure to indent four spaces!
guess_row = int(raw_input("Guess Row:"))
guess_col = int(raw_input("Guess Col:"))

if guess_row == ship_row and guess_col == ship_col:
print "Congratulations! You sunk my battleship!"
else:
if (guess_row < 0 or guess_row > 4) or (guess_col < 0 or guess_col > 4):
print "Oops, that's not even in the ocean."
elif(board[guess_row][guess_col] == "X"):
print "You guessed that one already."
else:
print "You missed my battleship!"
board[guess_row][guess_col] = "X"
if turn == 3:
print "Game Over"
print_board(board)``````

Let's play Battleship!
O O O O O
O O O O O
O O O O O
O O O O O
O O O O O
1
1
Guess Row: 2
Guess Col: 2
Guess Row: 2
Guess Col: 2
Guess Row: 2
Guess Col: 2
Guess Row: 2
Guess Col: 2
You missed my battleship!
Game Over
O O O O O
O O O O O
O O X O O
O O O O O
O O O O O
None

#2

see this beautiful comment:

``# Everything from here on should go in your for loop!``

this is currently your for loop:

``````for turn in range(4):# Be sure to indent four spaces!
guess_row = int(raw_input("Guess Row:"))
guess_col = int(raw_input("Guess Col:"))``````

which means it will prompt for coordinates 3 times, then runs with the last values. What you want to do, is run the coordinates each time after you ran it. So like the comment suggest, everything should be in the for loop. So that after each time you entered coordinates, it checks if the ship is hit