TierraEstella.frink

View or download 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=0 to 9
   for b=0 to 9
   {
      if a == b
         next
      for c=0 to 9
      {
         if c==a or c==b
            next
         for d=0 to 9
         {
            if d==a or d==b or d==c
               next
            for e=0 to 9
            {
               if e==a or e==b or e==c or e==d
                  next
               for f=0 to 9
               {
                  if f==a or f==b or f==c or f==d or f==e
                     next
                  for g=0 to 9
                  {
                     if g==a or g==b or g==c or g==d or g==e or g==f
                        next
                     for h=0 to 9
                     {
                        if h==a or h==b or h==c or h==d or h==e or h==f or h==g
                           next
                        for i=0 to 9
                        {
                           if i==a or i==b or i==c or i==d or i==e or i==f or i==g or i==h
                              next
                           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)]
                           }
                        }
                     }
                  }
               }
            }
         }
      }
   }


View or download 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 17590 days, 6 hours, 51 minutes ago.