initialise board arrays correctly

This commit is contained in:
Luca Conte 2024-12-10 12:44:34 +01:00
parent 6a57a6e1ff
commit b958ffd6b9
1 changed files with 3 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import java.util.ArrayList;
import java.util.List; import java.util.List;
public class Board { public class Board {
@ -10,6 +11,8 @@ public class Board {
public Board(int size) { public Board(int size) {
this.size = size; this.size = size;
this.ships = new ArrayList<>();
this.hits = new ArrayList<>();
this.createShip(size - 13); this.createShip(size - 13);
} }