0
[Solved] Random numbers keep generating
This is my edited (classified, heh) version of Codecademy's Battleship! tutorial. The problem is, I can't figure out why the ship doesn't sink when you enter the row and column. The randomizer for the position keeps randomizing. It worked before I added classes, and now... https://code.sololearn.com/c71mvn5Qb11t/?ref=app
2 Antworten
+ 1
Change test condition to this:
if guess_row == self.ship_row and guess_col == self.ship_col:
You were repositioning the ship with every guess. There are some other issues with your code like inconsistent use of mat/board, but with that fix it should work
0
Benjamin Jürgens, thanks! It no longer repositioning, though I do, as you said, have other issues to work out. =)