Browse Source

I think I fixed place on board for real?

experiment
Raphael Roberts 7 years ago
parent
commit
e7e29d7ebe
  1. 10
      Ship.java

10
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;
}
}
}

Loading…
Cancel
Save