The Wiki for Tale 4 is in read-only mode and is available for archival and reference purposes only. Please visit the current Tale 11 Wiki in the meantime.

If you have any issues with this Wiki, please post in #wiki-editing on Discord or contact Brad in-game.

Difference between revisions of "Talk:Chariot Routes"

From A Tale in the Desert
Jump to navigationJump to search
Line 3: Line 3:
 
= Route table calculation =
 
= Route table calculation =
 
Here, more or less, is the code I used to generate the route table. Feel free to modify and rerun it as needed.
 
Here, more or less, is the code I used to generate the route table. Feel free to modify and rerun it as needed.
 +
: I cleaned this up a bit so it actually runs, tweaked the output format so it's a bit more table-like, fixed a rounding bug in computation of travel times, and added Heaven's Gate to the routes. The main page has the newly regenerated output now. --[[User:Inkoaten|Inkoaten]] 07:50, 8 April 2009 (EST)
 +
 
<pre><nowiki>
 
<pre><nowiki>
 
import cStringIO
 
import cStringIO
Line 14: Line 16:
 
Cat's Claw Ridge,CCR,-403,6586
 
Cat's Claw Ridge,CCR,-403,6586
 
Falcon Bay,FB,4292,-632
 
Falcon Bay,FB,4292,-632
 +
Heaven's Gate,HG,-1683,6313
 
Khmun,KHM,-2092,480
 
Khmun,KHM,-2092,480
 
Meroe,MR,826,-3654
 
Meroe,MR,826,-3654
Line 28: Line 31:
 
   ("Cat's Claw Ridge", "Adn"),
 
   ("Cat's Claw Ridge", "Adn"),
 
   ("Cat's Claw Ridge", "Nomad's Paradise"),
 
   ("Cat's Claw Ridge", "Nomad's Paradise"),
 +
  ("Adn", "Heaven's Gate"),
 
   ("Adn", "Pyramid Lake"),
 
   ("Adn", "Pyramid Lake"),
 
   ("Adn", "Sinai"),
 
   ("Adn", "Sinai"),
 
   ("Adn", "Stillwater"),
 
   ("Adn", "Stillwater"),
 +
  ("Heaven's Gate", "Nomad's Paradise"),
 
   ("Pyramid Lake", "Sinai"),
 
   ("Pyramid Lake", "Sinai"),
 
   ("Nomad's Paradise", "Stillwater"),
 
   ("Nomad's Paradise", "Stillwater"),
Line 93: Line 98:
  
 
def toTimespan(secs):
 
def toTimespan(secs):
   secs = int(secs) / 60 * 5
+
   secs = int(secs / 60 * 5)
 
   return '%d:%.2d' % (secs/60, secs%60)
 
   return '%d:%.2d' % (secs/60, secs%60)
  
Line 104: Line 109:
 
# Print via table
 
# Print via table
 
def printVia():
 
def printVia():
   print '{|'
+
   names = stops.keys()
   print '|'
+
  names.sort()
   for name in names:
+
 
    print '!%s' % stops[name].shortname
+
   print '{| border="1"'
  print '|-'
+
   print "! !! " + " !! ".join([stops[x].shortname for x in names])
 
   for row in names:
 
   for row in names:
     print '!%s' % row
+
     print "|-"
 +
    cells = []
 
     for col in names:
 
     for col in names:
 
       time, via = distances[(stops[row], stops[col])]
 
       time, via = distances[(stops[row], stops[col])]
 
       if row == col:
 
       if row == col:
         print '|'
+
         cells.append("")
 
       elif via is None:
 
       elif via is None:
         print "|'''%s'''" % toTimespan(time)
+
         cells.append("'''%s'''" % toTimespan(time))
 
       else:
 
       else:
         print '|%s (%s)' % (toTimespan(time), via.shortname)
+
         cells.append("%s (%s)" % (toTimespan(time), via.shortname))
     print '|-'
+
 
 +
    print "! " + row
 +
     print "| " + " || ".join(cells)
 
   print '|}'
 
   print '|}'
 +
 +
printVia()
 
</nowiki></pre>
 
</nowiki></pre>
  

Revision as of 12:50, 8 April 2009

I've modified the regions.jpg in an attempt to show chariot routes. Unfortunately, several of them are currently 1-way so the lines have arrows on them. If both directions are open it's like 2 arrows bumping up against eachother making a diamond shape. Um, the graphics are rudimentary & really not that good. Also, just from looking at the thumbnail, I can tell it's not always so easy to see the arrows. But for a first draft, it's better than nothing. If anyone has any suggestions or comments, feel free to leave them here or change the image. amisibastet 21:25, 23 December 2008 (EST)

Route table calculation

Here, more or less, is the code I used to generate the route table. Feel free to modify and rerun it as needed.

I cleaned this up a bit so it actually runs, tweaked the output format so it's a bit more table-like, fixed a rounding bug in computation of travel times, and added Heaven's Gate to the routes. The main page has the newly regenerated output now. --Inkoaten 07:50, 8 April 2009 (EST)
import cStringIO
import csv
import math
import sys


chariots_csv = """\
Adn,Adn,1029,6958
Cat's Claw Ridge,CCR,-403,6586
Falcon Bay,FB,4292,-632
Heaven's Gate,HG,-1683,6313
Khmun,KHM,-2092,480
Meroe,MR,826,-3654
Nomad's Paradise,NP,-1419,2769
Pyramid Lake,PL,4286,7264
Queen's Retreat,QR,584,-6145
Saqqarah,SQ,640,-760
Shabbat Ab,SA,1419,1794
Sinai,SI,3205,4357
Stillwater,SW,1696,3718"""


routenames = [
  ("Cat's Claw Ridge", "Adn"),
  ("Cat's Claw Ridge", "Nomad's Paradise"),
  ("Adn", "Heaven's Gate"),
  ("Adn", "Pyramid Lake"),
  ("Adn", "Sinai"),
  ("Adn", "Stillwater"),
  ("Heaven's Gate", "Nomad's Paradise"),
  ("Pyramid Lake", "Sinai"),
  ("Nomad's Paradise", "Stillwater"),
  ("Nomad's Paradise", "Shabbat Ab"),
  ("Sinai", "Falcon Bay"),
  ("Stillwater", "Shabbat Ab"),
  ("Shabbat Ab", "Khmun"),
  ("Shabbat Ab", "Falcon Bay"),
  ("Khmun", "Meroe"),
  ("Saqqarah", "Meroe"),
  ("Saqqarah", "Queen's Retreat"),
  ("Falcon Bay", "Meroe"),
  ("Meroe", "Queen's Retreat")
]


class ChariotStop(object):
  def __init__(self, name, shortname, x, y):
    self.name = name
    self.shortname = shortname
    self.x = int(x)
    self.y = int(y)
  
  def getDistance(self, other):
    return math.sqrt((self.x-other.x)**2 + (self.y-other.y)**2)


def createRoutes(stops, routenames):
  routes = {}
  for src, dest in routenames:
    src_stop = stops[src]
    dest_stop = stops[dest]
    routes.setdefault(src_stop, set()).add(dest_stop)
    routes.setdefault(dest_stop, set()).add(src_stop)
  return routes


def calculateDistances(routes):
  distances = {}
  frontier = []
  
  # Populate frontier
  for src, dests in routes.iteritems():
    for dest in dests:
      distance = src.getDistance(dest)
      frontier.append((src, dest, distance, None))
      distances[(src, dest)] = (distance, None)
  
  while frontier:
    src, dest, distance, via = frontier.pop()
    for newdest in routes[dest]:
      leg = (src, newdest)
      cost = distance + dest.getDistance(newdest)
      if cost < distances.get(leg, (sys.maxint, None))[0]:
        if not via:
          via = dest
        distances[leg] = (cost, via)
        frontier.append((src, newdest, cost, via))
  
  return distances


def toTimespan(secs):
  secs = int(secs / 60 * 5)
  return '%d:%.2d' % (secs/60, secs%60)


reader = csv.reader(cStringIO.StringIO(chariots_csv))
stops = dict((x[0], ChariotStop(*x)) for x in reader)
routes = createRoutes(stops, routenames)
distances = calculateDistances(routes)

# Print via table
def printVia():
  names = stops.keys()
  names.sort()
  
  print '{| border="1"'
  print "! !! " + " !! ".join([stops[x].shortname for x in names])
  for row in names:
    print "|-"
    cells = []
    for col in names:
      time, via = distances[(stops[row], stops[col])]
      if row == col:
        cells.append("")
      elif via is None:
        cells.append("'''%s'''" % toTimespan(time))
      else:
        cells.append("%s (%s)" % (toTimespan(time), via.shortname))

    print "! " + row
    print "| " + " || ".join(cells)
  print '|}'

printVia()

route repair nearly complete

  • Thank you for the table! That looks great!
  • Does Heavens Gate have a chariot stop now? The last time I was up there was before some of the routes were fixed by a dev call.
  • Does Cat Claw Ridge have a second route? If so, where does it go & how many points are left? Probably to Nomads' Paradise since NP has a route to CCR but if someone could confirm that'd be great.

--AmisiBastet 09:42, 6 January 2009 (EST)

CCR doesn't have its route to Nomad's Paradise up yet. I actually cheated and included it in the table; as a result a couple of the routes are unachievable at the moment (namely, optimal routes from Nomad's Paradise to Adn, Pyramid Lake, and Sinai all pass through CCR). As far as I know, Heaven's Gate doesn't have a chariot stop (or if it does, not a working one). If anyone wants to update with coordinates and routes, I can fix the table.

--Osmirik 7:41, January 2009 (GMT)