about summary refs log tree commit diff stats
path: root/lib/Octans/Puzzle.rakumod
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2021-03-04 14:26:19 +0530
committerAndinus <andinus@nand.sh>2021-03-04 14:26:19 +0530
commitbdb1dbcea8c4ab9270caeacf6bfb448c35824a90 (patch)
tree7106498830bacd6cefa4e53c33e175ced8650670 /lib/Octans/Puzzle.rakumod
parentfba335150a95f7688c2e0ae279e837557d2b5a0e (diff)
downloadoctans-bdb1dbcea8c4ab9270caeacf6bfb448c35824a90.tar.gz
Mark visited gray squares with "*"
Diffstat (limited to 'lib/Octans/Puzzle.rakumod')
-rw-r--r--lib/Octans/Puzzle.rakumod6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Octans/Puzzle.rakumod b/lib/Octans/Puzzle.rakumod
index 731cc8e..e88a74a 100644
--- a/lib/Octans/Puzzle.rakumod
+++ b/lib/Octans/Puzzle.rakumod
@@ -17,4 +17,10 @@ class Puzzle is export {
 
     # Accessor for @!gray-squares.
     method gray-squares() { @!gray-squares; }
+
+    # Given $y, $x where $y is row index & $x is column index,
+    # is-gray-square returns if the cell is a gray square.
+    method is-gray-square(Int $y, Int $x) {
+        return so @!gray-squares.grep(($y, $x));
+    }
 }