Bug where ships were 1 too long fixed.

This commit is contained in:
blzimme000 2022-03-07 11:34:17 -06:00
parent 45f89a0d07
commit dc92d1629c

View file

@ -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";
} }