chiark
/
gitweb
/
~mdw
/
rocl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Late fix for new interface.
[rocl]
/
elite-path
diff --git
a/elite-path
b/elite-path
index bcddd6b85fcb25c779e9bd1fa54d193a28319bb5..3f117e002a0b035648c3de69c84aef826465957f 100755
(executable)
--- a/
elite-path
+++ b/
elite-path
@@
-1,12
+1,13
@@
#! /usr/bin/tclsh
#
#! /usr/bin/tclsh
#
-# $Id: elite-path,v 1.
3 2003/03/04 10:26:18
mdw Exp $
+# $Id: elite-path,v 1.
4 2003/03/07 00:42:10
mdw Exp $
-package require "elite" "1.0.
0
"
+package require "elite" "1.0.
1
"
set g $galaxy1
set ng 1
set weight weight-hops
set g $galaxy1
set ng 1
set weight weight-hops
+set d 70
set acc distance
for {set i 0} {$i < [llength $argv]} {incr i} {
set a [lindex $argv $i]
set acc distance
for {set i 0} {$i < [llength $argv]} {incr i} {
set a [lindex $argv $i]
@@
-21,6
+22,10
@@
for {set i 0} {$i < [llength $argv]} {incr i} {
}
destructure {ng g} $g
}
}
destructure {ng g} $g
}
+ "-d" {
+ incr i
+ set d [expr {int([lindex $argv $i] * 10)}]
+ }
"-w" {
incr i
set a [lindex $argv $i]
"-w" {
incr i
set a [lindex $argv $i]
@@
-57,7
+62,7
@@
for {set i 0} {$i < [llength $argv]} {incr i} {
}
set r {}
}
set r {}
-set ww [
worldinfo
$g]
+set ww [
elite-galaxylist
$g]
foreach-world $g ii {
set px($ii(seed)) 1
}
foreach-world $g ii {
set px($ii(seed)) 1
}
@@
-74,12
+79,10
@@
foreach a [lrange $argv $i end] {
lappend r $s
}
if {[llength $r] < 2} {
lappend r $s
}
if {[llength $r] < 2} {
- puts stderr "usage: $argv0 \[-g GAL
AXY
\] \[-w WEIGHT\] \[-a ACC\] PLANET PLANET ..."
+ puts stderr "usage: $argv0 \[-g GAL
\] \[-d DIST
\] \[-w WEIGHT\] \[-a ACC\] PLANET PLANET ..."
exit 1
}
exit 1
}
-puts -nonewline stderr "\[computing adjacency table..."
-adjacency $ww adj
-puts stderr " done\]"
+elite-adjacency adj $ww $d
set home [lindex $r 0]
set start $home
set rt {}
set home [lindex $r 0]
set start $home
set rt {}
@@
-87,7
+90,7
@@
set tm 0
foreach w [lrange $r 1 end] {
destructure {p m} [shortest-path adj $home $w $weight]
if {![llength $p]} {
foreach w [lrange $r 1 end] {
destructure {p m} [shortest-path adj $home $w $weight]
if {![llength $p]} {
- puts
-stderr "$argv0: no route from [worldinfo $home] to [worldinfo
$w]"
+ puts
stderr "$argv0: no route from [worldname $home] to [worldname
$w]"
exit 1
}
set tm [expr {$tm + $m}]
exit 1
}
set tm [expr {$tm + $m}]
@@
-105,7
+108,7
@@
set tw 0
foreach s $rt {
if {![string equal $s $last]} {
elite-worldinfo p $s
foreach s $rt {
if {![string equal $s $last]} {
elite-worldinfo p $s
- set d [expr {[
world
-distance $x $y $p(x) $p(y)]/10.0}]
+ set d [expr {[
elite
-distance $x $y $p(x) $p(y)]/10.0}]
incr h
set td [expr {$td + $d}]
set summ [format "%3d %s" $h [world-summary $s]]
incr h
set td [expr {$td + $d}]
set summ [format "%3d %s" $h [world-summary $s]]
@@
-126,7
+129,7
@@
foreach s $rt {
}
}
if {$tw != $tm} { error "inconsistent metric ($tw != $tm)" }
}
}
if {$tw != $tm} { error "inconsistent metric ($tw != $tm)" }
-set summ "("
+set summ "
#
("
set sep ""
if {![string equal $acc "distance"]} {
append summ [format "%stotal distance = %.1f LY" $sep $td]
set sep ""
if {![string equal $acc "distance"]} {
append summ [format "%stotal distance = %.1f LY" $sep $td]
@@
-138,4
+141,4
@@
if {![string equal $weight "weight-hops"] && \
append summ [format "%stotal metric = %s" $sep $tm]
}
append summ ")"
append summ [format "%stotal metric = %s" $sep $tm]
}
append summ ")"
-if {![string equal $summ "()"]} { puts $summ }
+if {![string equal $summ "
#
()"]} { puts $summ }