From dc92d1629c579dd731b1e52f45d3e8a24b2b9217 Mon Sep 17 00:00:00 2001 From: blzimme000 Date: Mon, 7 Mar 2022 11:34:17 -0600 Subject: [PATCH] Bug where ships were 1 too long fixed. --- src/Board.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Board.java b/src/Board.java index 2592b35..82fcefc 100644 --- a/src/Board.java +++ b/src/Board.java @@ -30,7 +30,7 @@ public class Board{ } for (int i = 0; i < squares[0].length; i++){ 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; squares[c][i] = "b"; } @@ -42,7 +42,7 @@ public class Board{ } for (int i = 0; i < squares[0].length; i++){ 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; squares[c][i] = "b"; }