--- /dev/null
+#! /usr/bin/tclsh
+#
+# $Id$
+
+package require "elite" "1.0.1"
+package require "vector" "1.0.0"
+package require "graph" "1.0.0"
+
+set gg {1 2 3 4 5 6 7 8}
+set maxdist 80
+set minratio 10
+
+for {set i 0} {$i < [llength $argv]} {incr i} {
+ set a [lindex $argv $i]
+ switch -glob -- $a {
+ "-maxdist" {
+ incr i
+ set maxdist [expr {int([lindex $argv $i] * 10)}]
+ }
+ "-minratio" {
+ incr i
+ set minratio [lindex $argv $i]
+ }
+ "--" {
+ incr i
+ break
+ }
+ "-*" {
+ puts stderr "usage: $argv0 \[-maxdist DIST\] \[-minratio RATIO\] \[GALAXY\] ..."
+ exit 1
+ }
+ default {
+ break
+ }
+ }
+}
+
+if {[llength $argv] > $i} {
+ set gg [lrange $argv $i end]
+}
+
+foreach g $gg {
+ destructure {. gs} [parse-galaxy-spec $g]
+ set l [elite-galaxylist $gs]
+ set i 0
+ foreach {w x y} $l {
+ set index($w) $i
+ incr i
+ }
+ elite-adjacency a $l
+ set v [vector {256 256} -1]
+ foreach {w x y} $l {
+ set i $index($w)
+ foreach {ww xx yy} $a($w) {
+ set j $index($ww)
+ $v set $i $j [elite-distance $x $y $xx $yy]
+ }
+ $v set $i $i 0
+ }
+ destructure {lv pv} [graph-shortest-path $v]
+
+ elite-adjacency b $l $maxdist
+ foreach {w x y} $l {
+ set i $index($w)
+ foreach {ww xx yy} $b($w) {
+ set d [elite-distance $x $y $xx $yy]
+ if {$d <= 70 || [string compare $w $ww] > 0} { continue }
+ set j $index($ww)
+ set dd [$lv get $i $j]
+ set r [expr {$dd/"$d.0"}]
+ if {$r >= $minratio} {
+ puts "$g: [worldname $w] -> [worldname $ww]: $d $dd ($r)"
+ }
+ }
+ }
+ $v destroy
+ $lv destroy
+ $pv destroy
+}
+