Commits

Anonymous committed 95fe574

Extract a _y_indexes method.

  • Participants
  • Parent commits 822d93f

Comments (0)

Files changed (1)

File abc-path/perl-quick-and-dirty/abc-path-solver.pl

     return $self->{_layout};
 }
 
+sub _y_indexes
+{
+    return (0 .. $BOARD_LEN_LIM);
+}
+
 sub _init
 {
     my ($self, $args) = @_;
 {
     my ($solver, $sub_ref) = (@_);
 
-    foreach my $y (0 .. $BOARD_LEN_LIM)
+    foreach my $y ($solver->_y_indexes)
     {
         foreach my $x (0 .. $BOARD_LEN_LIM)
         {
 
         $solver->set_verdicts_for_letter_sets(
             \@major_diagonal_letters, 
-            [map { [$_,$_] } (0 .. 4)],
+            [map { [$_,$_] } $solver->_y_indexes],
         );
     }
 
         {
             $solver->set_verdicts_for_letter_sets(
                 [substr($top_row, $x+1, 1), substr($bottom_row, $x+1, 1),],
-                [map { [$x,$_] } (0 .. 4)],
+                [map { [$x,$_] } $solver->_y_indexes],
             );
         }
     }
     {
 
         my ($clue_x, $clue_y, $clue_letter);
-        foreach my $y (0 .. $BOARD_LEN_LIM)
+        foreach my $y ($solver->_y_indexes)
         {
             my $row = $rows[$y];
             $solver->set_verdicts_for_letter_sets(
             \" | ", map {; "X = $_", (\' | '); } (0 .. $BOARD_LEN_LIM)
         );
 
-    foreach my $y (0 .. $BOARD_LEN_LIM)
+    foreach my $y ($solver->_y_indexes)
     {
         $tb->add(
             map