From 35efa24f9a92e823cfb3b4fdb02a2fe8c4c2e9d2 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 29 Oct 2022 19:41:28 +0100 Subject: [PATCH] wip --- analyse | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/analyse b/analyse index a9cb8f3..e28e1ce 100755 --- a/analyse +++ b/analyse @@ -6,17 +6,17 @@ while (<>) { my @coords = qw(0 0 0); chomp; my $l = $_; - print join '', @coords; - while ($l =~ s/^.//) { + for (;;) { + print join '', @coords, ','; + last unless $l =~ s/^.//; $_ = $&; my $delta = s/[A-Z]/lc $&/e ? +1 : -1; my $i = - $& eq 'X' ? 0 : - $& eq 'Y' ? 1 : - $& eq 'Z' ? 2 : - die; + /x/ ? 0 : + /y/ ? 1 : + /z/ ? 2 : + die "$_ ?"; $coords[$i] += $delta; - print " ", join '', @coords; } print "\n"; } -- 2.30.2