TierraEstella.frink

Download or view TierraEstella.frink in plain text format


// Solver for Teirra [sic] Estella cache,
// http://www.geocaching.com/seek/cache_details.aspx?guid=39e41b35-2915-41cd-a943-10e044f0dc56

for [a,b,c,d,e,f,g,h,i,j] = array[0 to 9].permute[]
{
   j = i + e
   if j==a or j==b or j==c or j==d or j==e or j==f or j==g or j==h or j==i
      next
   first = 1000 a + 100 b + 10 c + d
   second = 1000 e + 100 f + 10 g + b
   sum = 10000 e + 1000 f + 100 c + 10 b + h
   if (first+second == sum)
   {
      println["a=$a\tb=$b\tc=$c\td=$d\te=$e\tf=$f\tg=$g\th=$h\ti=$i\tj=$j"]
      println["   $a $b $c $d"]
      println["+  $e $f $g $b"]
      println["==========="]
      println[" $e $f $c $b $h"]
      println[]
      latstr = "$e$b$a$f.$j$h$e"
      longstr = "$e$e$f$j$j.$g$f$e"
      println["lat = sqrt[$latstr]"]
      println["long = sqrt[$longstr]"]
      println[]
      lat =  sqrt[eval[latstr]] degrees
      long = sqrt[eval[longstr]] degrees
      println["lat : " + format[lat, degrees, 5]]
      println["long: " + format[long, degrees, 5]]
      println[]
      println["lat : " + (lat->DMS)]
      println["long: " + (long->DMS)]
   }
}


Download or view TierraEstella.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 19355 days, 23 hours, 47 minutes ago.