Mines.pm

filter: Statementstmt 93.3% 155 / 166 Branchbran 88.4% 69 / 78 Conditioncond 66.6% 12 / 18 MC/DCmcdc 33.3% 4 / 12 Subroutinesub 96.3% 26 / 27 Podpod 100% 16 / 16 totaltotal 88.9% 282 / 317 CC 50 SCAR 18.5
CC
50
Cov
90%
step
14.0
_fill_count
10.0
fill_mines
8.2
CRAP 6.4
« Mines/Play.pm ↑ Summary
1 package Games::Mines;
2  
3 50 require 5.005_62;
4 50 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 50 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 50 ▶use Carp qw(verbose);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 50 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 50 our $VERSION = sprintf("%01d.%02d", 0,q$Revision: 2.2 $ =~ /(\d+)\.(\d+)/);
10  
11 =head1 NAME
12  
13 Games::Mines - a mine finding game
14  
15 =head1 SYNOPSIS
16  
17 require Games::Mines;
18  
19 # get new 30x40 mine field with 50 mines
20 my($game) = Games::Mines->new(30,40,50);
21  
22 # fill with mines, except at the four corners
23 $game->fill_mines([0,0],[0,40],[30,0],[30,40]);
24  
25 =head1 DESCRIPTION
26  
27 This module is the basis for mine finding game. It contains the basic
28 methods necessary for a game.
29  
30 =cut
31  
32 # Preloaded methods go here.
33  
34 # internal:
35 # - nothing
36 # 1-8 - number of mines around that square
37 # * - mine (steped on )
38 # visible:
39 # . - unsteped
40 # F - unstepped and flaged
41 # - stepped
42  
43 # 'unstepped' => '.',
44 # 'flagged' => 'F',
45 # 'mine' => '*',
46 # 'wrong' => 'X',
47 # 'blank' => ' ',
48  
49  
50 =head2 Class and object Methods
51  
52  
53 =over 5
54  
55 =item $Class->new;
56  
57 The new method creates a new mine field object. It takes three
58 arguments: The width of the field, the height of the field, and the
59 number of mines.
60  
61 =cut
62  
63 69 ▶sub new {
Subroutine new: called CC=3 SCAR=11.0
Pod documented
64 69 my($base) = shift;
65
66 # Get class or object ref and construct object
67 69 ▶ my($class) = ref($base) || $base;
Condition66%2/3
ref $base || $base
l!l&&r!l&&!r
3660
MC/DC0%0/2
ref $base || $base
ref $base $base
Truth table66%2/3
A || B
A= ref $baseB= $base
ABresult
1X1
011
000
68
69 69 my($width,$height,$count,) = @_;
70
71 69 ▶ if( $count > $width*$height ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($count > $width * $height) 1 68 69
72 1 return;
73 }
74
75 68 my($mine_field) = {
76 'on' => 0,
77 'field' => undef(),
78  
79 # mine count
80 'count' => $count,
81 'flags' => 0,
82 'unknown' => 0,
83
84 # game information text
85 'why' => 'not started',
86 'pre-start-text' => 'not started',
87 'running-text' => 'Running',
88 'win-text' => 'You Win!!!',
89 'lose-text' => 'KABOOOOOM!!!',
90  
91 # extra field to hold other field information
92 'extra'=>{}
93 };
94
95 68 bless $mine_field, $class;
96
97 68 $mine_field->_reset($width,$height);
98
99 68 return $mine_field;
100 }
101  
102 =item $obj->width
103  
104 Returns the width of a mine field.
105  
106 =cut
107  
108 5395 ▶sub width {
Subroutine width: called CC=1 SCAR=0.0
Pod documented
109 5395 my($mine_field) = shift;
110 5395 return $#{$mine_field->{field} };
111 }
112  
113 =item $obj->height
114  
115 Returns the height of the mine field.
116  
117 =cut
118  
119 6757 ▶sub height {
Subroutine height: called CC=1 SCAR=0.0
Pod documented
120 6757 my($mine_field) = shift;
121 6757 return $#{$mine_field->{field}[0]};
122 }
123  
124 =item $obj->count
125  
126 Returns the total number of mines within the field.
127  
128 =cut
129  
130 2 ▶sub count {
Subroutine count: called CC=1 SCAR=0.0
Pod documented
131 2 my($mine_field) = shift;
132 2 return $mine_field->{count};
133 }
134  
135 =item $obj->running
136  
137 Returns a boolean that says if game play is still possible. Returns
138 false after field is create, but before fill_mines is called. Also
139 returns false if the whole field has been solved, or a mine has
140 been stepped on.
141  
142 =cut
143  
144 11 ▶sub running {
Subroutine running: called CC=3 SCAR=12.0
Pod documented
145 11 my($mine_field) = shift;
146 11 my($test);
147 11 my($w,$h);
148
149 11 ▶ if($mine_field->found_all && $mine_field->{on}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mine_field->found_all and $mine_field->{"on"}) 0 11 11
Condition66%2/3
$mine_field->found_all and $mine_field->{"on"}
!ll&&!rl&&r
920
MC/DC0%0/2
$mine_field->found_all and $mine_field->{"on"}
$mine_field->found_all $mine_field->{"on"}
Truth table66%2/3
A and B
A= $mine_field->found_allB= $mine_field->{"on"}
ABresult
0X0
100
111
150 0 $mine_field->{on}=0;
151 0 $mine_field->{why} = $mine_field->{'win-text'};
152 }
153 11 return $mine_field->{on};
154 }
155  
156 =item $obj->why
157  
158 Returns a human readable status of the current game. Mostly useful
159 after a game has ended to say why it has ended.
160  
161 =cut
162  
163 7 ▶sub why {
Subroutine why: called CC=1 SCAR=0.0
Pod documented
164 7 my($mine_field) = shift;
165  
166 7 return $mine_field->{why};
167 }
168  
169 =item $obj->fill_mines
170  
171 Randomly fills the field with mines. It takes any number of arguments,
172 which should be array references to a pair of coordinates of where
173 I<NOT> to put a mine.
174  
175 =cut
176  
177 55 ▶sub fill_mines {
Subroutine fill_mines: called CC=7 SCAR=21.0
Pod documented
178 55 my($mine_field) = shift;
179 55 my(@exclude) = @_;
180 55 my($i,$w,$h);
181
182 55 $mine_field->{why} = $mine_field->{'running-text'};
183 55 $mine_field->{on} = 1;
184
185 {
186 55 ▶ for($i = 1; $i<=$mine_field->{count}; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $mine_field->{"count"}) 310 55 365
187 312 $w = int( rand( $mine_field->width() +1 ) );
188 312 $h = int( rand( $mine_field->height() +1 ) );
189 312 ▶ redo if( $mine_field->_at($w,$h) eq '*');
Branch: 1 branch
BranchTrueFalseTotal
if $mine_field->_at($w, $h) eq "*" 2 310 312
190
191 0 ▶ redo if( grep { ($_->[0] == $w) && ($_->[1] == $h)} @exclude);
Branch: 1 branch
BranchTrueFalseTotal
if grep {$_->[0] == $w and $_->[1] == $h;} @exclude 0 310 310
Condition0%0/3
$_->[0] == $w && $_->[1] == $h
!ll&&!rl&&r
000
MC/DC0%0/2
$_->[0] == $w && $_->[1] == $h
$_->[0] == $w $_->[1] == $h
Truth table0%0/3
A && B
A= $_->[0] == $wB= $_->[1] == $h
ABresult
0X0
100
111
192 310 ▶ redo unless( $mine_field->_check_mine_placement($w,$h));
Branch: 1 branch
BranchTrueFalseTotal
unless $mine_field->_check_mine_placement($w, $h) 0 310 310
193
194 310 $mine_field->{field}[$w][$h]{contains} = '*';
195 310 $mine_field->_fill_count($w,$h);
196 }
197 55 ▶ unless( $mine_field->_check_mine_field ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($mine_field->_check_mine_field) 0 55 55
198 0 $mine_field->_clear_mines;
199 0 redo;
200 }
201 }
202 }
203  
204 =item $obj->at($col,$row)
205  
206 Returns what is visible at the coordinates given. Takes two arguments:
207 the col and the row coordinates.
208  
209 =cut
210  
211 165 ▶sub at {
Subroutine at: called CC=2 SCAR=6.9
Pod documented
212 165 my($mine_field) = shift;
213 165 my($w,$h) = $mine_field->_limit(@_);
214
215 165 ▶ if($mine_field->shown($w,$h)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mine_field->shown($w, $h)) 93 72 165
216 93 return $mine_field->_at($w,$h);
217 }
218 72 return $mine_field->{field}[$w][$h]{visibility};
219 }
220  
221 =item $obj->hidden($col,$row)
222  
223 Returns a boolean saying if the position has not been stepped on and
224 exposed. Takes two arguments: the col and the row coordinates.
225  
226 =cut
227  
228 16 ▶sub hidden {
Subroutine hidden: called CC=1 SCAR=0.0
Pod documented
229 16 my($mine_field) = shift;
230 16 my($w,$h) = $mine_field->_limit(@_);
231 16 return $mine_field->{field}[$w][$h]{visibility};
232 }
233  
234 =item $obj->shown($col,$row)
235  
236 Returns a boolean saying if the position has been stepped on and
237 exposed. Takes two arguments: the col and the row coordinates.
238  
239 =cut
240  
241 341 ▶sub shown {
Subroutine shown: called CC=1 SCAR=0.0
Pod documented
242 341 my($mine_field) = shift;
243 341 my($w,$h) = $mine_field->_limit(@_);
244 #print STDERR "getting value w,h: ", $w,", ",$h,"\n";
245 341 return not($mine_field->{field}[$w][$h]{visibility});
246 }
247  
248  
249 =item $obj->step($col,$row)
250  
251 Steps on a particular square, exposing what was underneath. Takes
252 two arguments: the col and the row coordinates. Note that if the
253 particular field is blank, indicating it has no mines in any of
254 the surrounding squares, it will also automatically step on those
255 squares as well. Returns false if already stepped on that square,
256 or if a mine is under it. Returns true otherwise.
257  
258 =cut
259  
260 14 ▶sub step {
Subroutine step: called CC=14 SCAR=26.4
Pod documented
261 14 my($mine_field) = shift;
262
263 14 my(@stepping) = ( [ $mine_field->_limit(@_) ] );
264  
265 14 ▶ while(@stepping) {
Branch: 1 branch
BranchTrueFalseTotal
if (@stepping) 52 13 65
266 52 my($w,$h) = @{ shift @stepping };
267
268 52 ▶ next if( $mine_field->shown($w,$h) );
Branch: 1 branch
BranchTrueFalseTotal
if $mine_field->shown($w, $h) 12 40 52
269 40 $mine_field->{field}[$w][$h]{visibility} = '';
270 40 $mine_field->{unknown}--;
271
272 40 ▶ if($mine_field->_at($w,$h) eq '*' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($mine_field->_at($w, $h) eq "*") 1 39 40
273 1 $mine_field->{field}[$w][$h]{visibility} = 'X';
274 1 $mine_field->{on} = 0;
275 1 $mine_field->{why}= $mine_field->{'lose-text'};
276 1 return;
277 }
278
279 39 ▶ if( $mine_field->at($w,$h) eq ' ') {
Branch: 1 branch
BranchTrueFalseTotal
if ($mine_field->at($w, $h) eq " ") 15 24 39
280 15 foreach my $dw (-1..1) {
281 45 ▶ next if( $w+$dw <0);
Branch: 1 branch
BranchTrueFalseTotal
if $w + $dw < 0 9 36 45
282 36 ▶ next if( $w+$dw > $mine_field->width());
Branch: 1 branch
BranchTrueFalseTotal
if $w + $dw > $mine_field->width 3 33 36
283
284 33 foreach my $dh (-1 ..1) {
285 99 ▶ next if($dw ==0 && $dh==0);
Branch: 1 branch
BranchTrueFalseTotal
if $dw == 0 and $dh == 0 15 84 99
Condition100%3/3
$dw == 0 and $dh == 0
!ll&&!rl&&r
543015
MC/DC100%2/2
$dw == 0 and $dh == 0
$dw == 0 $dh == 0
Truth table100%3/3
A and B
A= $dw == 0B= $dh == 0
ABresult
0X0
100
111
286 84 ▶ next if( $h+$dh <0);
Branch: 1 branch
BranchTrueFalseTotal
if $h + $dh < 0 19 65 84
287 65 ▶ next if( $h+$dh > $mine_field->height());
Branch: 1 branch
BranchTrueFalseTotal
if $h + $dh > $mine_field->height 7 58 65
288
289 58 ▶ next if( $mine_field->shown($w+$dw,$h+$dh) );
Branch: 1 branch
BranchTrueFalseTotal
if $mine_field->shown($w + $dw, $h + $dh) 20 38 58
290 38 push @stepping, [$w+$dw, $h+$dh];
291 }
292 }
293 }
294 }
295 13 return 1;
296 }
297  
298 =item $obj->flag($col,$row)
299  
300 Place a flag on a particular unexposed square. Takes two arguments:
301 the col and the row coordinates. Returns true if square can and has
302 been flagged.
303  
304 =cut
305  
306 10 ▶sub flag {
Subroutine flag: called CC=3 SCAR=11.1
Pod documented
307 10 my($mine_field) = shift;
308
309 10 my($w,$h) = $mine_field->_limit(@_);
310
311 10 ▶ return if( $mine_field->shown($w,$h) );
Branch: 1 branch
BranchTrueFalseTotal
if $mine_field->shown($w, $h) 0 10 10
312 10 ▶ return if( $mine_field->flagged($w,$h) );
Branch: 1 branch
BranchTrueFalseTotal
if $mine_field->flagged($w, $h) 0 10 10
313 10 $mine_field->{field}[$w][$h]{visibility} = 'F';
314 10 $mine_field->{flags}++;
315 10 $mine_field->{unknown}--;
316 10 return 1;
317 }
318  
319 =item $obj->unflag($col,$row)
320  
321 Removes a flag from a particular unexposed square. Takes two
322 arguments: the col and the row coordinates. Returns true if
323 square can and has been unflagged.
324  
325 =cut
326  
327 2 ▶sub unflag {
Subroutine unflag: called CC=3 SCAR=11.1
Pod documented
328 2 my($mine_field) = shift;
329
330 2 my($w,$h) = $mine_field->_limit(@_);
331
332 2 ▶ return if( $mine_field->shown($w,$h) );
Branch: 1 branch
BranchTrueFalseTotal
if $mine_field->shown($w, $h) 0 2 2
333 2 ▶ return if( not $mine_field->flagged($w,$h) );
Branch: 1 branch
BranchTrueFalseTotal
unless $mine_field->flagged($w, $h) 0 2 2
334 2 $mine_field->{field}[$w][$h]{visibility} = '.';
335 2 $mine_field->{flags}--;
336 2 $mine_field->{unknown}++;
337 2 return 1;
338 }
339  
340  
341 =item $obj->flagged($col,$row)
342  
343 Returners a boolean based on whether a flag has been placed on a
344 particular square. Takes two arguments: the col and the row
345 coordinates.
346  
347 =cut
348  
349 29 ▶sub flagged {
Subroutine flagged: called CC=2 SCAR=6.9
Pod documented
350 29 my($mine_field) = shift;
351
352 29 my($w,$h) = $mine_field->_limit(@_);
353
354 29 ▶ return if( $mine_field->shown($w,$h) );
Branch: 1 branch
BranchTrueFalseTotal
if $mine_field->shown($w, $h) 3 26 29
355 #print STDERR Dumper($mine_field->{field}[$w][$h]{visibility}, $h,$w);
356 26 return $mine_field->{field}[$w][$h]{visibility} eq 'F';
357 }
358  
359  
360 =item $obj->flags
361  
362 Return the total number of flags throughout the whole field.
363  
364 =cut
365  
366 6 ▶sub flags {
Subroutine flags: called CC=1 SCAR=0.0
Pod documented
367 6 my($mine_field) = shift;
368 6 return $mine_field->{flags};
369 }
370  
371 =item $obj->found_all
372  
373 Returners a boolean saying whether all mines have been found or not.
374  
375 =cut
376  
377 23 ▶sub found_all {
Subroutine found_all: called CC=6 SCAR=18.1
Pod documented
378 23 my($mine_field) = shift;
379
380 23 my($w,$h);
381
382 23 ▶ if( $mine_field->{flags}+$mine_field->{unknown}
Branch: 1 branch
BranchTrueFalseTotal
if ($mine_field->{"flags"} + $mine_field->{"unknown"} == $mine_field->{"count"}) 4 19 23
383 == $mine_field->{count} ) {
384
385 4 ▶ for($w = 0; $w <= $mine_field->width(); $w++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($w <= $mine_field->width) 12 4 16
386 12 ▶ for($h = 0; $h<= $mine_field->height(); $h++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($h <= $mine_field->height) 36 12 48
387 36 ▶ if( $mine_field->at($w,$h) eq 'F' &&
Branch: 1 branch
BranchTrueFalseTotal
if ($mine_field->at($w, $h) eq "F" and not $mine_field->_at($w, $h) eq "*") 0 36 36
Condition66%2/3
$mine_field->at($w, $h) eq "F" and not $mine_field->_at($w, $h) eq "*"
!ll&&!rl&&r
2880
MC/DC0%0/2
$mine_field->at($w, $h) eq "F" and not $mine_field->_at($w, $h) eq "*"
$mine_field->at($w, $h) eq "F" not $mine_field->_at($w, $h) eq "*"
Truth table66%2/3
A and not(B)
A= $mine_field->at($w, $h) eq "F"B= not $mine_field->_at($w, $h) eq "*"
ABresult
0X0
100
111
388 not ($mine_field->_at($w,$h) eq '*')){
389 0 return;
390 }
391 }
392 }
393 4 $mine_field->{why} = $mine_field->{'win-text'};
394 4 $mine_field->{on} = 0;
395
396 4 return 1;
397 }
398
399 19 return;
400 }
401  
402  
403 =begin for developers
404  
405 =item $obj->_limit($col,$row)
406  
407 An internal check to make sure the coordinates given are actually on
408 the field itself. Will truncate to the field limits and values
409 that are no.
410  
411 =cut
412  
413 3493 ▶sub _limit {
Subroutine _limit: called CC=5 SCAR=16.1
414 3493 my($mine_field) = shift;
415 3493 my($w,$h,@rest)=@_;
416  
417 3493 ▶ if( $w<0) {
Branch: 2 branches
BranchTrueFalseTotal
if ($w < 0) { } 2 3491 3493
elsif ($w >= $mine_field->width) { } 544 2947 3491
418 2 $w =0;
419 }
420 elsif( $w >= $mine_field->width() ) {
421 544 $w = $mine_field->width();
422 }
423
424 3493 ▶ if($h<0) {
Branch: 2 branches
BranchTrueFalseTotal
if ($h < 0) { } 2 3491 3493
elsif ($h >= $mine_field->height) { } 510 2981 3491
425 2 $h=0;
426 }
427 elsif( $h >= $mine_field->height() ) {
428 510 $h = $mine_field->height();
429 }
430  
431 3493 return ($w,$h,@rest);
432 }
433  
434 =item $obj->_reset($width,$height)
435
436 This is the method that actually sets up the whole data structure that
437 represents the field, and fills it with the default values. Takes
438 two arguments: The width of the column and row of the
439 coordinates.
440  
441 =cut
442  
443 71 ▶sub _reset {
Subroutine _reset: called CC=3 SCAR=11.0
444 71 my($mine_field) = shift;
445
446 71 my($width,$height) = @_;
447 71 my($w,$h);
448
449 71 $mine_field->{field} = [ undef() x $width ];
450 71 ▶ for( $w = 0; $w <= $width-1; $w++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($w <= $width - 1) 644 71 715
451 644 $mine_field->{field}[$w] = [ undef() x $height ];
452
453 644 ▶ for( $h = 0; $h<= $height-1; $h++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($h <= $height - 1) 40540 644 41184
454 40540 $mine_field->{field}[$w][$h] = {
455 contains => " ",
456 visibility => '.',
457 extra =>{},
458 };
459 }
460 }
461 71 $mine_field->{unknown} = $w * $h;
462 }
463  
464  
465 =item $obj->_fill_count($col,$row)
466  
467 Used to add to the numbers surrounding a mine. Normally called from
468 fill_mines to fill the field with the mine counts. Takes two
469 coordinates, the $col and $row coordinates. Assumes there is a
470 mine at the center.
471  
472 =cut
473  
474 316 ▶sub _fill_count {
Subroutine _fill_count: called CC=10 SCAR=23.0
475 316 my($mine_field) = shift;
476
477 316 my($w,$h)=$mine_field->_limit(@_);
478
479 316 foreach my $dw (-1..1) {
480 948 ▶ next if( $w+$dw <0);
Branch: 1 branch
BranchTrueFalseTotal
if $w + $dw < 0 1 947 948
481 947 ▶ next if( $w+$dw > $mine_field->width());
Branch: 1 branch
BranchTrueFalseTotal
if $w + $dw > $mine_field->width 58 889 947
482
483 889 foreach my $dh (-1 ..1) {
484 2667 ▶ next if($dw ==0 && $dh==0);
Branch: 1 branch
BranchTrueFalseTotal
if $dw == 0 and $dh == 0 316 2351 2667
Condition100%3/3
$dw == 0 and $dh == 0
!ll&&!rl&&r
1719632316
MC/DC100%2/2
$dw == 0 and $dh == 0
$dw == 0 $dh == 0
Truth table100%3/3
A and B
A= $dw == 0B= $dh == 0
ABresult
0X0
100
111
485 2351 ▶ next if( $h+$dh <0);
Branch: 1 branch
BranchTrueFalseTotal
if $h + $dh < 0 115 2236 2351
486 2236 ▶ next if( $h+$dh > $mine_field->height());
Branch: 1 branch
BranchTrueFalseTotal
if $h + $dh > $mine_field->height 176 2060 2236
487
488 2060 ▶ next if( $mine_field->_at($w+$dw, $h+$dh) eq '*');
Branch: 1 branch
BranchTrueFalseTotal
if $mine_field->_at($w + $dw, $h + $dh) eq "*" 7 2053 2060
489
490 2053 $mine_field->{field}[ $w+$dw ][ $h+$dh ]{contains}++;
491 }
492 }
493 }
494  
495 =item $obj->_clear_mines
496  
497 Clears mine field of all bombs, and resets the field to a pre-start
498 state.
499  
500 =cut
501  
502 0 ▶sub _clear_mines {
Subroutine _clear_mines: not called CC=1 SCAR=6.9
503 0 my($mine_field) = shift;
504 0 my($i);
505 0 my($w,$h) = ($mine_field->width(),$mine_field->height() );
506 0 $mine_field->{'why'} = $mine_field->{'pre-start-text'};
507 0 $mine_field->_reset($w,$h);
508 }
509  
510 =item $obj->_check_mine_placement($col,$row)
511  
512 It checks to see if a mine should be placed at the the coordinates given.
513 Returns true if it's an acceptable position.
514  
515 This is a placeholder method for modules that inherit from this one
516 to over ride. Always returns true by default.
517  
518 =cut
519  
520 311 ▶sub _check_mine_placement {
Subroutine _check_mine_placement: called CC=1 SCAR=0.0
521 311 return 1;
522 }
523  
524 =item $obj->_check_mine_field
525  
526 It checks to see if a mine field has an acceptable layout.
527 Returns true if it's an acceptable field.
528  
529 This is a placeholder method for modules that inherit from this one
530 to over ride. Always returns true by default.
531  
532 =cut
533  
534 56 ▶sub _check_mine_field {
Subroutine _check_mine_field: called CC=1 SCAR=0.0
535 56 return 1;
536 }
537  
538 =item $obj->_at($col,$row)
539  
540 Returns what is underneath at the coordinates given, regardless of
541 weather it is uncovered or not. Takes two arguments: the col and
542 the row coordinates.
543  
544 =cut
545  
546 2594 ▶sub _at {
Subroutine _at: called CC=1 SCAR=0.0
547 2594 my($mine_field) = shift;
548 2594 my($w,$h) = $mine_field->_limit(@_);
549 2594 return $mine_field->{field}[$w][$h]{contains};
550 }
551  
552  
553  
554 =end for developers
555  
556 =back
557  
558 =head1 AUTHOR
559  
560 Martyn W. Peck <mwp@mwpnet.com>
561  
562 =head1 BUGS
563  
564 None known. But if you find any, let me know.
565  
566 =head1 COPYRIGHT
567  
568 Copyright 2003, Martyn Peck. All Rights Reserves.
569  
570 This program is free software. You may copy or redistribute
571 it under the same terms as Perl itself.
572  
573 =cut
574  
575 50 1;
576  
« Mines/Play.pm ↑ Summary