1. Shlomi Fish
  2. nurikabe

Commits

shl...@b384bcd7-cfd4-0310-aca0-d78b80f7b91b  committed 4fbf236

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

  • Participants
  • Parent commits c170857
  • Branches default

Comments (0)

Files changed (5)

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

View file
     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()];
 }

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

View file
         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)
                 ) }
             ],

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

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

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

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

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

View file
 {
     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;
 }
 
 {