|
|
|
@ -2,6 +2,7 @@ import java.util.Arrays; |
|
|
|
public class Ship{ |
|
|
|
public static final int X = 0; |
|
|
|
public static final int Y = 1; |
|
|
|
private static final boolean DEBUG = false; |
|
|
|
private boolean vertical; |
|
|
|
private int[] start; |
|
|
|
private int[] end; |
|
|
|
@ -175,12 +176,22 @@ public class Ship{ |
|
|
|
int c; |
|
|
|
if (this.vertical){ |
|
|
|
for (c = this.start[Y];c <= this.end[Y];c++){ |
|
|
|
board[c][x_col] = this.length; |
|
|
|
if (DEBUG) { |
|
|
|
board[c][x_col] = this.length; |
|
|
|
} |
|
|
|
else { |
|
|
|
board[c][x_col] = 4; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
for (c = this.start[X];c <= this.end[X];c++){ |
|
|
|
board[y_col][c] = this.length; |
|
|
|
if (DEBUG) { |
|
|
|
board[y_col][c] = this.length; |
|
|
|
} |
|
|
|
else { |
|
|
|
board[y_col][c] = 4; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|