Danger Will Robinson; 11/19. Why Does Ship Row: 3 and Ship Col: 4 not show "X" in that position in the dashboard?


#1

Please can someone explain to me why the co-rdinates:

Ship Row:3
Ship Col: 4

in the dashboard of the screenshot below shows “X” in the position below.

This position looks more like:

Ship Row: 3
Ship Col: 3

is it because of the -1 in

return randint(0, len(board[0]) - 1)

part of the code?


#2

You didn’t shoot at (4, 3), you shot at (2, 2) (look at your console)

And, because you’re using lists to store the board, and you are using the input as indexes with no translation, (2, 2) is the third column of the third row

Additionally, if you consider 0 to be the first natural number, then you very well may want to label the first row 0, not 1. Also keep in mind that origo is at position (0, 0), which square do you want to be at origo?


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.