Doesn't make sense


#1

I spend a lot of time on this one just because I made it right? Looking from the player's perspective, if he introduces the 1 and 1 why the X should be in (2,2)? Shouldn't the corect code be
print board[guess_row-1][guess_col-1]?

I am just asking :smiley:

`


#2

Hi @florib ,

For the user, as well as well the programmer, this series of exercises considers the rows and columns to be numbered from 0 to 4. The X in your board is in the correct place.

If you were to program a game outside the venue of Codecademy's Battleship game, you could redesign the view and the controlling code to number rows and columns from 1 to 5, but for these exercises, it is probably best to use the system established by the instructions.


#3

the problem is that lists are zero indexed based. You can tweak it to make it look like 1,1 represent the top left corner.

but i won't do what you suggested, i would do:

guess_row = int(raw_input("Guess Row:"))
guess_col = int(raw_input("Guess Col:"))
guess_row -= 1
guess_col -= 1

this will convert the user input (1,2,3,4,5) to the coordinates on the board (0,1,2,3,4)

it is easier to change the user input, then messing with the indexes on your boardd


#4

Thank you both for replying. :slight_smile:


#5

@florib ,

Your idea to offer the user a more intuitive perspective is a good one. However, if you try to implement that perspective throughout the Battleship! course, you will have to create workarounds in order to get Codecademy's submission correctness test (SCT) to accept your code.

See @stetim94's suggestion, and then consider implementing your ideas in the final exercise, Extra Credit, where the SCT is very lenient.


#6