diff --git a/Ship.java b/Ship.java index f507cfb..948f196 100644 --- a/Ship.java +++ b/Ship.java @@ -190,14 +190,16 @@ public class Ship{ } public void placeOnBoard(int[][] board){ + int x_col = this.start[X] + int y_col = this.start[Y]; if (this.vertical){ - for (int c = this.start[X];c <= this.end[X];c++){ - board[this.start[Y]][c] = 4; + for (int c = this.start[Y];c <= this.end[Y];c++){ + board[x_col][c] = this.length; } } else { - for (int c = this.start[Y];c <= this.end[Y];c++){ - board[c][this.start[X]] = 4; + for (int c = this.start[X];c <= this.end[X];c++){ + board[c][y_col] = this.lenth; } } }