From a5629a7e3ead9dc8a5396987d2f9b3c1f5ac0ae9 Mon Sep 17 00:00:00 2001 From: Michael Mikonos <127171689+mknos@users.noreply.github.com> Date: Thu, 8 Feb 2024 13:05:50 +0800 Subject: [PATCH] maze: tweak usage string * Program name comes after the "usage: " prefix * Init maze data without using a counter variable --- bin/maze | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bin/maze b/bin/maze index 4c2f4890..e2e73408 100755 --- a/bin/maze +++ b/bin/maze @@ -25,7 +25,7 @@ my (@maze, @walk); ## Parse maze type options. sub usage { - die "$0 usage: $0 [-fl|-fi|-df|-sf] [width height]\n" + die "usage: $0 [-fl|-fi|-df|-sf] [width height]\n" } sub traverse_by_depth { -1 } # normal mazes (long walks) @@ -75,10 +75,7 @@ my $test_height = $height - 1; # ## initialize the maze - -for (my $y=0; $y<$height; $y++) { - push @maze, [ (0) x $width ]; -} +@maze = map { [ (0) x $width ] } (1 .. $height); my $in = int(rand($width)); push @walk, [0, $in];