From 837ad6a076d4d7fdf9db336bd01c9470a21e3845 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 29 Oct 2022 19:45:36 +0100 Subject: [PATCH] wip before Rust --- analyse | 28 ++++++---------------------- vertices | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 22 deletions(-) create mode 100755 vertices diff --git a/analyse b/analyse index e28e1ce..ebbc2b8 100755 --- a/analyse +++ b/analyse @@ -1,24 +1,8 @@ -#!/usr/bin/perl -w +#!/bin/sh -use strict; +./vertices >t.vx -while (<>) { - my @coords = qw(0 0 0); - chomp; - my $l = $_; - for (;;) { - print join '', @coords, ','; - last unless $l =~ s/^.//; - $_ = $&; - my $delta = s/[A-Z]/lc $&/e ? +1 : -1; - my $i = - /x/ ? 0 : - /y/ ? 1 : - /z/ ? 2 : - die "$_ ?"; - $coords[$i] += $delta; - } - print "\n"; -} - -STDOUT->error and die $!; +for x in 0 3; do for y in 0 3; do for z in 0 3; do + grep $x$y$z, t.vx >u.vx + mv u.vx t.vx +done; done; done diff --git a/vertices b/vertices new file mode 100755 index 0000000..e28e1ce --- /dev/null +++ b/vertices @@ -0,0 +1,24 @@ +#!/usr/bin/perl -w + +use strict; + +while (<>) { + my @coords = qw(0 0 0); + chomp; + my $l = $_; + for (;;) { + print join '', @coords, ','; + last unless $l =~ s/^.//; + $_ = $&; + my $delta = s/[A-Z]/lc $&/e ? +1 : -1; + my $i = + /x/ ? 0 : + /y/ ? 1 : + /z/ ? 2 : + die "$_ ?"; + $coords[$i] += $delta; + } + print "\n"; +} + +STDOUT->error and die $!; -- 2.30.2