+ 2
Battleship game
I am using java. how would you compare the rows and columns of one ship to another in the battleship game? Also, how would you put the values of each ship in the battleship board with scanner?
1 Réponse
+ 2
Hello Rush Shah
I would fill a matrix (2d array) using a nested for loop and each ship gets a letter (or a number).
For example:
xxxAAA
BxCCxx
Bxxxxxx
BxxDDD
With another nested for loop you can check if there is an empty field or a ship.