chiark / gitweb /
Fix `ave-' to `avg-' in economy names. What was I thinking?
[rocl] / elite-pairs
index 6f81995aabf26998f453aa0290898fbdcdb60942..d4ce23a5ea065e117f57304c082fee4e51d9a980 100755 (executable)
@@ -1,4 +1,6 @@
 #! /usr/bin/tclsh
+#
+# $Id: elite-pairs,v 1.3 2003/02/26 00:02:51 mdw Exp $
 
 package require "elite" "1.0.0"
 
@@ -29,6 +31,7 @@ proc ok {s vv expr} {
 
 set g $galaxy1
 set d 70
+set v 0
 for {set i 0} {$i < [llength $argv]} {incr i} {
   set a [lindex $argv $i]
   switch -glob -- $a {
@@ -46,12 +49,18 @@ for {set i 0} {$i < [llength $argv]} {incr i} {
       incr i
       set d [expr {[lindex $argv $i] * 10}]
     }
+    "-v" {
+      incr v
+    }
+    "-q" {
+      incr v -1
+    }
     "--" {
       incr i
       break
     }
     "-*" {
-      puts stderr "usage: $argv0 \[-g GALAXY\] \[-d DIST\] AEXPR BEXPR"
+      puts stderr "usage: $argv0 \[-qv\] \[-g GALAXY\] \[-d DIST\] AEXPR BEXPR"
       exit 1
     }
     default {
@@ -77,8 +86,14 @@ foreach {s x y} $ww {
   foreach {ss xx yy} $adj($s) {
     set d [world-distance $x $y $xx $yy]
     if {[ok $ss {a d} $bexpr]} {
-      puts [format "%-11s %-11s (%.1f LY)" $a(name) [worldname $ss] \
-         [expr {[world-distance $x $y $xx $yy]/10.0}]]
+      set d [expr {[world-distance $x $y $xx $yy]/10.0}]
+      if {$v} {
+       puts [format "%s (%.1f LY)" [world-summary $s] $d]
+       puts [world-summary $ss]
+       puts ""
+      } else {
+       puts [format "%-11s %-11s (%.1f LY)" $a(name) [worldname $ss] $d]
+      }
     }
   }
 }