chiark
/
gitweb
/
~ian
/
z3-treefoil
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
prep
[z3-treefoil]
/
vertices
1
#!/usr/bin/perl -w
2
3
use strict;
4
5
while (<>) {
6
my @coords = qw(0 0 0);
7
chomp;
8
my $l = $_;
9
for (;;) {
10
print join '', @coords, ',';
11
last unless $l =~ s/^.//;
12
$_ = $&;
13
my $delta = s/[A-Z]/lc $&/e ? +1 : -1;
14
my $i =
15
/x/ ? 0 :
16
/y/ ? 1 :
17
/z/ ? 2 :
18
die "$_ ?";
19
$coords[$i] += $delta;
20
}
21
print "\n";
22
}
23
24
STDOUT->error and die $!;