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

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143``` ```package Games::Nurikabe::Solver::Coords; use strict; use warnings; use base 'Games::Nurikabe::Solver::Base'; __PACKAGE__->mk_acc_ref([qw( x y )] ); =head1 NAME Games::Nurikabe::Solver::Coords - an object representing a coordinates pair in the Nurikabe board. =head1 VERSION Version 0.01 =cut our \$VERSION = '0.01'; =head1 SYNOPSIS use Games::Nurikabe::Solver::Coords; my \$coords = Games::Nurikabe::Solver::Coords->new({x => \$x, y => \$y); print "X = ", \$coords->x(); print "Y = ", \$coords->y(); =head1 METHODS =head2 ->new({y => \$y, x => \$x}) Creates a new object with \$y and \$x as coordinates. =cut sub _init { my (\$self, \$args) = @_; \$self->y(\$args->{'y'}); \$self->x(\$args->{'x'}); return; } =head2 x() Returns the column (or "x") coordinate. =head2 y() Returns the row (or "y") coordinate. =head2 to_s() Convert the coordinates to a string representation. =cut sub to_s { my \$self = shift; return \$self->y() . ',' . \$self->x(); } =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) = @_; return [\$self->y(), \$self->x()]; } 1; =head1 AUTHOR Shlomi Fish, C<< >> =head1 BUGS Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc Games::Nurikabe::Solver::Coords You can also look for information at: =over 4 =item * RT: CPAN's request tracker L =item * AnnoCPAN: Annotated CPAN documentation L =item * CPAN Ratings L =item * Search CPAN L =item * Version control repository: L =back =head1 ACKNOWLEDGEMENTS =head1 COPYRIGHT & LICENSE Copyright 2008 Shlomi Fish, all rights reserved. This program is released under the following license: MIT/X11 Licence. =cut 1; # End of Games::Nurikabe::Solver::Coords ```