Skip to content

Commit 8378b27

Browse files
authored
maze: tweak usage string (#443)
* Program name comes after the "usage: " prefix * Init maze data without using a counter variable
1 parent 10cffde commit 8378b27

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

bin/maze

+2-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ my (@maze, @walk);
2525
## Parse maze type options.
2626

2727
sub usage {
28-
die "$0 usage: $0 [-fl|-fi|-df|-sf] [width height]\n"
28+
die "usage: $0 [-fl|-fi|-df|-sf] [width height]\n"
2929
}
3030

3131
sub traverse_by_depth { -1 } # normal mazes (long walks)
@@ -75,10 +75,7 @@ my $test_height = $height - 1;
7575

7676
#
7777
## initialize the maze
78-
79-
for (my $y=0; $y<$height; $y++) {
80-
push @maze, [ (0) x $width ];
81-
}
78+
@maze = map { [ (0) x $width ] } (1 .. $height);
8279

8380
my $in = int(rand($width));
8481
push @walk, [0, $in];

0 commit comments

Comments
 (0)