From e7e29d7ebefdee5a672afddc7cf6a755a4eee237 Mon Sep 17 00:00:00 2001 From: rlbr Date: Thu, 4 Oct 2018 15:25:16 -0500 Subject: [PATCH] I think I fixed place on board for real? --- Ship.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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; } } }