Commits

Anonymous committed 4fbf236

Renamed _to_pair as to_aref() and made it an API function.

Comments (0)

Files changed (5)

nurikabe-solver/Games-Nurikabe-Solver/lib/Games/Nurikabe/Solver/Coords.pm

     return $self->y() . ',' . $self->x();
 }
 
-# TODO : Add an exception throw here because this is only a temporary method
-# that should later not be used.
-sub _to_pair
+=head2 [$y, $x] = $coords->to_aref()
+
+Returns an array reference containing the y and x coordinates (in that order).
+
+=cut
+
+sub to_aref
 {
-    my $self = shift;
+    my ($self) = @_;
 
     return [$self->y(), $self->x()];
 }

nurikabe-solver/Games-Nurikabe-Solver/t/calc-vicinity.t

         my ($coords, $vicinity, $blurb) = @_;
 
         eq_or_diff(
-            [ map { $_->_to_pair() } @{$board->_calc_vicinity(
+            [ map { $_->to_aref() } @{$board->_calc_vicinity(
                     Games::Nurikabe::Solver::Coords->new($coords)
                 ) }
             ],

nurikabe-solver/Games-Nurikabe-Solver/t/island-surround.t

         );
 
     return eq_or_diff(
-        [map { $_->_to_pair() } @{$got_surrounded_cells}],
+        [map { $_->to_aref() } @{$got_surrounded_cells}],
         $bi->positions("B"),
         $blurb
     );

nurikabe-solver/Games-Nurikabe-Solver/t/solve-refactor.t

 {
     my ($m, $verdict) = @_;
 
-    return [map { $_->_to_pair() } @{$m->get_verdict_cells($verdict)} ];
+    return [map { $_->to_aref() } @{$m->get_verdict_cells($verdict)} ];
 }
 
 {

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

 {
     my ($m, $verdict) = @_;
 
-    return [map { $_->_to_pair() } @{$m->get_verdict_cells($verdict)} ];
+    return [map { $_->to_aref() } @{$m->get_verdict_cells($verdict)} ];
 }
 
 sub _base_coords
 {
     my ($m) = @_;
 
-    return $m->reason_param("base_coords")->_to_pair();
+    return $m->reason_param("base_coords")->to_aref;
 }
 
 {