Bug where ships were 1 too long fixed.
This commit is contained in:
parent
45f89a0d07
commit
dc92d1629c
1 changed files with 2 additions and 2 deletions
|
@ -30,7 +30,7 @@ public class Board{
|
||||||
}
|
}
|
||||||
for (int i = 0; i < squares[0].length; i++){
|
for (int i = 0; i < squares[0].length; i++){
|
||||||
for (int c = 0; c < 10; c++){ // C++ :)
|
for (int c = 0; c < 10; c++){ // C++ :)
|
||||||
if (c == row && i >= col && i <= col + len){
|
if (c == row && i >= col && i < col + len){
|
||||||
if (squares[c][i].equals("x") || squares[c][i].equals("b"))return false;
|
if (squares[c][i].equals("x") || squares[c][i].equals("b"))return false;
|
||||||
squares[c][i] = "b";
|
squares[c][i] = "b";
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ public class Board{
|
||||||
}
|
}
|
||||||
for (int i = 0; i < squares[0].length; i++){
|
for (int i = 0; i < squares[0].length; i++){
|
||||||
for (int c = 0; c < 10; c++){ // C++ :)
|
for (int c = 0; c < 10; c++){ // C++ :)
|
||||||
if (i == col && c >= row && c <= row + len){
|
if (i == col && c >= row && c < row + len){
|
||||||
if (squares[c][i].equals("x") || squares[c][i].equals("b"))return false;
|
if (squares[c][i].equals("x") || squares[c][i].equals("b"))return false;
|
||||||
squares[c][i] = "b";
|
squares[c][i] = "b";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue