1. Shlomi Fish
  2. nurikabe

Commits

shl...@b384bcd7-cfd4-0310-aca0-d78b80f7b91b  committed 986249e

Added the next (and final) shape to _solve_using_adjacent_whites .

  • Participants
  • Parent commits 39a5715
  • Branches default

Comments (0)

Files changed (2)

File nurikabe-solver/Games-Nurikabe-Solver/lib/Games/Nurikabe/Solver/Board.pm

View file
  • Ignore whitespace
                     offset => [0,2],
                     blacks => [[0,1]],
                 },
+                {
+                    offset => [2,0],
+                    blacks => [[1,0]],
+                },
             );
             foreach my $shape (@shapes)
             {

File nurikabe-solver/Games-Nurikabe-Solver/t/solve1.t

View file
  • Ignore whitespace
 use strict;
 use warnings;
 
-use Test::More tests => 46;
+use Test::More tests => 51;
 
 use Test::Differences;
 
             [1,1],
             "Base coords[0] is (1,1)."
         );
+
+        $m = shift(@$moves);
+
+        # TEST
+        is ($m->reason(), "adjacent_whites", "reason[1] is OK.");
+
+        # TEST
+        eq_or_diff(
+            $m->get_verdict_cells($NK_BLACK),
+            [[4,4]],
+            "Verdicted cells[1] are [[4,4]].",
+        );
+
+        # TEST
+        eq_or_diff ($m->reason_param("offset"), [2,0], "Offset[1] is (2,0).");
+
+        # TEST
+        eq_or_diff ($m->reason_param("islands"), [3,4],
+            "Islands of [1] are [3,4]",
+        );
+
+        # TEST
+        eq_or_diff (
+            $m->reason_param("base_coords"),
+            [3,4],
+            "Base coords[0] is (3,4)."
+        );
     }
 }