diff options
| author | Mohammad S Anwar <Mohammad.Anwar@yahoo.com> | 2021-08-23 23:58:13 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-23 23:58:13 +0100 |
| commit | 9caf07efec558b399f139ad89f0886ad035b6b69 (patch) | |
| tree | a384d91ebe5d40887597ca8ce3e86ff5975a8ac9 /challenge-126 | |
| parent | 006bff0d767f8b63c9251ef185d4e70f85ed6bd3 (diff) | |
| parent | dfdcc6e2e49d14ec16c4f55ed4e9d848712433fd (diff) | |
| download | perlweeklychallenge-club-9caf07efec558b399f139ad89f0886ad035b6b69.tar.gz perlweeklychallenge-club-9caf07efec558b399f139ad89f0886ad035b6b69.tar.bz2 perlweeklychallenge-club-9caf07efec558b399f139ad89f0886ad035b6b69.zip | |
Merge pull request #4773 from PerlBoy1967/patch-5
Update ch-2.pl
Diffstat (limited to 'challenge-126')
| -rwxr-xr-x | challenge-126/perlboy1967/perl/ch-2.pl | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/challenge-126/perlboy1967/perl/ch-2.pl b/challenge-126/perlboy1967/perl/ch-2.pl index 23c2a52037..9f5cacc7b5 100755 --- a/challenge-126/perlboy1967/perl/ch-2.pl +++ b/challenge-126/perlboy1967/perl/ch-2.pl @@ -29,8 +29,9 @@ printBoard(@B); sub generateBoard($$\@) { my ($w,$h,$arB) = @_; - my @c = qw(X . . . .); # 1 in 5 chance of placing a bomb - + my $bRatio = 5; # 1 in 5 chance of placing a bomb + my @c = ('X', map '.', 1..$bRatio-1); + foreach my $y (1 .. $h) { foreach my $x (1 .. $w) { $arB->[$y][$x] = $c[int rand(scalar @c)]; |
