3 # $Id: elite-prices,v 1.2 2003/02/25 00:25:38 mdw Exp $
5 package require "elite" "1.0.0"
7 # --- An optimal trading pair ---
9 set lezaer "1598f98a6581"
10 set esmaonbe "7997d18a0d89"
12 set np [expr {[llength $products]/2}]
13 puts -nonewline stderr "\[[string repeat { } $np]\] "
14 puts -nonewline stderr "\[[string repeat { } 32]\]"
15 puts -nonewline stderr "\r\[[string repeat { } $np]\] \["
17 foreach {a s} [list l $lezaer e $esmaonbe] {
18 for {set f 0} {$f < 256} {incr f} {
20 foreach {t p} $products { destructure [list ${a}($f:$t) .] $m($t) }
21 if {($f & 15) == 15} { puts -nonewline stderr "."; flush stderr }
24 foreach {t p} $products {
30 foreach {t p} $products {
32 puts -nonewline stderr "\r\[[string repeat . $i]"
33 puts -nonewline stderr "[string repeat { } [expr {$np - $i}]]\] "
34 puts -nonewline stderr "\[[string repeat { } 32]\]"
35 puts -nonewline stderr "\r\[[string repeat . $i]"
36 puts -nonewline stderr "[string repeat { } [expr {$np - $i}]]\] \["
39 for {set f 0} {$f < 256} {incr f} {
46 set pr [expr {$pl - $pe}]
47 if {$pr < $min($t)} { set min($t) $pr }
48 if {$pr > $max($t)} { set max($t) $pr }
52 if {($j & 7) == 0} { puts -nonewline stderr "."; flush stderr }
57 foreach {t p} $products {
58 puts [format "%-15s %5d %4d %4d" $t \
59 $min($t) [expr {$tot($t)/65536}] $max($t)]