-# --- adjacency WW ADJ [D] ---
-#
-# Fill in the array ADJ with the adjacency table for the worlds listed in the
-# worldinfo list WW. That is, for each world seed S, ADJ(S) is set to a
-# worldinfo list containing the worlds within D (default 70) decilightyears
-# of S.
-
-proc adjacency {p adj {d 70}} {
- upvar 1 $adj a
- array set a {}
- foreach {s x y} $p {
- set done($s) 1
- lappend a($s)
- foreach {ss xx yy} $p {
- if {[info exists done($ss)]} { continue }
- if {abs($x - $xx) > $d + 10 || abs($y - $yy) > $d + 10 ||
- [world-distance $x $y $xx $yy] > $d} { continue }
- lappend a($s) $ss $xx $yy
- lappend a($ss) $s $x $y
- }
- }
-}
-