From ea70aa5181d79086b70ef91eddbc072c39f754f3 Mon Sep 17 00:00:00 2001 From: observer Date: Thu, 30 Jan 2025 22:11:16 +0000 Subject: [PATCH] add isValid overload that uses local state --- src/main/java/com/shr4pnel/minesweeper/GridWrapper.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/shr4pnel/minesweeper/GridWrapper.java b/src/main/java/com/shr4pnel/minesweeper/GridWrapper.java index 6de4143..9caf493 100644 --- a/src/main/java/com/shr4pnel/minesweeper/GridWrapper.java +++ b/src/main/java/com/shr4pnel/minesweeper/GridWrapper.java @@ -159,4 +159,13 @@ public class GridWrapper { private boolean isValid(int column, int row) { return column >= 0 && column < COLUMNS && row >= 0 && row < ROWS; } + + /** + * Checks if a given column and row is in bounds using local state + * + * @return A boolean representing the tile being in bounds. + */ + public boolean isValid() { + return this.currentColumn >= 0 && this.currentColumn < COLUMNS && this.currentRow >= 0 && this.currentRow < ROWS; + } }