Difference between revisions of "User:Nolari"

From Kerbal Space Program Wiki
Jump to: navigation, search
Line 205: Line 205:
 
| data-sort-value="10.0" | 10×
 
| data-sort-value="10.0" | 10×
 
|}
 
|}
 +
 +
<pre>
 +
from decimal import Decimal
 +
 +
lines = '''Sun In Space Low 11
 +
Sun In Space High 2
 +
Sun Surface Landed 1
 +
Sun Splashed 1
 +
Sun Recovered Craft 4
 +
Sun Space Threshold Altitude 1E+09
 +
Kerbin In Space Low 1
 +
Kerbin In Space High 1.5
 +
Kerbin Surface Landed 0.3
 +
Kerbin Splashed 0.4
 +
Kerbin Recovered Craft 1
 +
Kerbin Flying Low 0.7
 +
Kerbin Flying High 0.9
 +
Kerbin Flying Threshold Altitude 18000
 +
Kerbin Space Threshold Altitude 250000
 +
Mun In Space Low 3
 +
Mun In Space High 2
 +
Mun Surface Landed 4
 +
Mun Splashed 1
 +
Mun Recovered Craft 2
 +
Mun Space Threshold Altitude 60000
 +
Minmus In Space Low 4
 +
Minmus In Space High 2.5
 +
Minmus Surface Landed 5
 +
Minmus Splashed 1
 +
Minmus Recovered Craft 2.5
 +
Minmus Space Threshold Altitude 30000
 +
Moho In Space Low 8
 +
Moho In Space High 7
 +
Moho Surface Landed 10
 +
Moho Splashed 1
 +
Moho Recovered Craft 7
 +
Moho Space Threshold Altitude 80000
 +
Eve In Space Low 7
 +
Eve In Space High 5
 +
Eve Surface Landed 8
 +
Eve Splashed 8
 +
Eve Recovered Craft 5
 +
Eve Flying Low 6
 +
Eve Flying High 6
 +
Eve Flying Threshold Altitude 22000
 +
Eve Space Threshold Altitude 400000
 +
Duna In Space Low 7
 +
Duna In Space High 5
 +
Duna Surface Landed 8
 +
Duna Splashed 1
 +
Duna Recovered Craft 5
 +
Duna Flying Low 5
 +
Duna Flying High 5
 +
Duna Flying Threshold Altitude 12000
 +
Duna Space Threshold Altitude 140000
 +
Ike In Space Low 7
 +
Ike In Space High 5
 +
Ike Surface Landed 8
 +
Ike Splashed 1
 +
Ike Recovered Craft 5
 +
Ike Space Threshold Altitude 50000
 +
Jool In Space Low 7
 +
Jool In Space High 6
 +
Jool Surface Landed 30
 +
Jool Splashed 1
 +
Jool Recovered Craft 6
 +
Jool Flying Low 12
 +
Jool Flying High 9
 +
Jool Flying Threshold Altitude 120000
 +
Jool Space Threshold Altitude 4000000
 +
Laythe In Space Low 9
 +
Laythe In Space High 8
 +
Laythe Surface Landed 14
 +
Laythe Splashed 12
 +
Laythe Recovered Craft 8
 +
Laythe Flying Low 11
 +
Laythe Flying High 10
 +
Laythe Flying Threshold Altitude 10000
 +
Laythe Space Threshold Altitude 200000
 +
Vall In Space Low 9
 +
Vall In Space High 8
 +
Vall Surface Landed 12
 +
Vall Splashed 1
 +
Vall Recovered Craft 8
 +
Vall Space Threshold Altitude 90000
 +
Bop In Space Low 9
 +
Bop In Space High 8
 +
Bop Surface Landed 12
 +
Bop Splashed 1
 +
Bop Recovered Craft 8
 +
Bop Space Threshold Altitude 25000
 +
Tylo In Space Low 10
 +
Tylo In Space High 8
 +
Tylo Surface Landed 12
 +
Tylo Splashed 1
 +
Tylo Recovered Craft 8
 +
Tylo Space Threshold Altitude 250000
 +
Gilly In Space Low 8
 +
Gilly In Space High 6
 +
Gilly Surface Landed 9
 +
Gilly Splashed 1
 +
Gilly Recovered Craft 6
 +
Gilly Space Threshold Altitude 6000
 +
Pol In Space Low 9
 +
Pol In Space High 8
 +
Pol Surface Landed 12
 +
Pol Splashed 1
 +
Pol Recovered Craft 8
 +
Pol Space Threshold Altitude 22000
 +
Dres In Space Low 7
 +
Dres In Space High 6
 +
Dres Surface Landed 8
 +
Dres Splashed 1
 +
Dres Recovered Craft 6
 +
Dres Space Threshold Altitude 25000
 +
Eeloo In Space Low 12
 +
Eeloo In Space High 10
 +
Eeloo Surface Landed 15
 +
Eeloo Splashed 1
 +
Eeloo Recovered Craft 10
 +
Eeloo Space Threshold Altitude 60000
 +
'''.splitlines()
 +
 +
situations = ['Surface Landed', 'Splashed', 'Flying Low', 'Flying High',
 +
              'Flying Threshold Altitude', 'In Space Low', 'In Space High',
 +
              'Space Threshold Altitude', 'Recovered Craft']
 +
bodies = dict()
 +
for line in lines:
 +
  body,situation,value = line.split('\t')
 +
  if body == 'Sun':
 +
    body = 'Kerbol'
 +
  if body not in bodies:
 +
    bodies[body] = {'Name': body}
 +
  bodies[body][situation] = Decimal(value)
 +
 +
for i,body in enumerate(['Kerbol', 'Moho', 'Eve', 'Gilly', 'Kerbin', 'Mun',
 +
                        'Minmus', 'Duna', 'Ike', 'Dres', 'Jool', 'Laythe',
 +
                        'Vall', 'Tylo', 'Bop', 'Pol', 'Eeloo']):
 +
  bodies[body]['Rank'] = i
 +
 +
altitude_units = ['m', 'km', 'Mm', 'Gm']
 +
for body in sorted(bodies.itervalues(), key=lambda body: body['Rank']):
 +
  print '|-'
 +
  print '| style="font-weight: bold;" | [[{0}]]'.format(body['Name'])
 +
  for situation in situations:
 +
    if situation not in body:
 +
      print '| style="background-color: silver;" | N/A'
 +
    elif situation == 'Splashed' and body['Splashed'] < body['Surface Landed']:
 +
      print '| style="background-color: silver;" | N/A'
 +
    elif situation.endswith('Threshold Altitude'):
 +
      sort_key = '{0:010n}'.format(body[situation])
 +
      unit_index = 0
 +
      magnitude = body[situation]
 +
      while magnitude >= 1000:
 +
        unit_index += 1
 +
        magnitude /= 1000
 +
      print '| data-sort-value="{0}" | {1}&nbsp;{2}'.format(sort_key, magnitude, altitude_units[unit_index])
 +
    else:
 +
      print '| data-sort-value="{0:04.1f}" | {1}&times;'.format(body[situation], body[situation])
 +
</pre>

Revision as of 09:36, 13 May 2014

Surface Atmosphere Space
Celestial body Landed Splashed Flying Low Flying High Border Orbit Low Orbit High Border Craft Recovery
Kerbol N/A N/A N/A 11× 1 Gm
Moho 10× N/A N/A N/A N/A 80 km
Eve 22 km 400 km
Gilly N/A N/A N/A N/A 6 km
Kerbin 0.3× 0.4× 0.7× 0.9× 18 km 1.5× 250 km
Mun N/A N/A N/A N/A 60 km
Minmus N/A N/A N/A N/A 2.5× 30 km 2.5×
Duna N/A 12 km 140 km
Ike N/A N/A N/A N/A 50 km
Dres N/A N/A N/A N/A 25 km
Jool 30× N/A 12× 120 km 4 Mm
Laythe 14× N/A 11× 10× 10 km 200 km
Vall 12× N/A N/A N/A N/A 90 km
Tylo 12× N/A N/A N/A N/A 10× 250 km
Bop 12× N/A N/A N/A N/A 25 km
Pol 12× N/A N/A N/A N/A 22 km
Eeloo 15× N/A N/A N/A N/A 12× 10× 60 km 10×
from decimal import Decimal

lines = '''Sun	In Space Low	11
Sun	In Space High	2
Sun	Surface Landed	1
Sun	Splashed	1
Sun	Recovered Craft	4
Sun	Space Threshold Altitude	1E+09
Kerbin	In Space Low	1
Kerbin	In Space High	1.5
Kerbin	Surface Landed	0.3
Kerbin	Splashed	0.4
Kerbin	Recovered Craft	1
Kerbin	Flying Low	0.7
Kerbin	Flying High	0.9
Kerbin	Flying Threshold Altitude	18000
Kerbin	Space Threshold Altitude	250000
Mun	In Space Low	3
Mun	In Space High	2
Mun	Surface Landed	4
Mun	Splashed	1
Mun	Recovered Craft	2
Mun	Space Threshold Altitude	60000
Minmus	In Space Low	4
Minmus	In Space High	2.5
Minmus	Surface Landed	5
Minmus	Splashed	1
Minmus	Recovered Craft	2.5
Minmus	Space Threshold Altitude	30000
Moho	In Space Low	8
Moho	In Space High	7
Moho	Surface Landed	10
Moho	Splashed	1
Moho	Recovered Craft	7
Moho	Space Threshold Altitude	80000
Eve	In Space Low	7
Eve	In Space High	5
Eve	Surface Landed	8
Eve	Splashed	8
Eve	Recovered Craft	5
Eve	Flying Low	6
Eve	Flying High	6
Eve	Flying Threshold Altitude	22000
Eve	Space Threshold Altitude	400000
Duna	In Space Low	7
Duna	In Space High	5
Duna	Surface Landed	8
Duna	Splashed	1
Duna	Recovered Craft	5
Duna	Flying Low	5
Duna	Flying High	5
Duna	Flying Threshold Altitude	12000
Duna	Space Threshold Altitude	140000
Ike	In Space Low	7
Ike	In Space High	5
Ike	Surface Landed	8
Ike	Splashed	1
Ike	Recovered Craft	5
Ike	Space Threshold Altitude	50000
Jool	In Space Low	7
Jool	In Space High	6
Jool	Surface Landed	30
Jool	Splashed	1
Jool	Recovered Craft	6
Jool	Flying Low	12
Jool	Flying High	9
Jool	Flying Threshold Altitude	120000
Jool	Space Threshold Altitude	4000000
Laythe	In Space Low	9
Laythe	In Space High	8
Laythe	Surface Landed	14
Laythe	Splashed	12
Laythe	Recovered Craft	8
Laythe	Flying Low	11
Laythe	Flying High	10
Laythe	Flying Threshold Altitude	10000
Laythe	Space Threshold Altitude	200000
Vall	In Space Low	9
Vall	In Space High	8
Vall	Surface Landed	12
Vall	Splashed	1
Vall	Recovered Craft	8
Vall	Space Threshold Altitude	90000
Bop	In Space Low	9
Bop	In Space High	8
Bop	Surface Landed	12
Bop	Splashed	1
Bop	Recovered Craft	8
Bop	Space Threshold Altitude	25000
Tylo	In Space Low	10
Tylo	In Space High	8
Tylo	Surface Landed	12
Tylo	Splashed	1
Tylo	Recovered Craft	8
Tylo	Space Threshold Altitude	250000
Gilly	In Space Low	8
Gilly	In Space High	6
Gilly	Surface Landed	9
Gilly	Splashed	1
Gilly	Recovered Craft	6
Gilly	Space Threshold Altitude	6000
Pol	In Space Low	9
Pol	In Space High	8
Pol	Surface Landed	12
Pol	Splashed	1
Pol	Recovered Craft	8
Pol	Space Threshold Altitude	22000
Dres	In Space Low	7
Dres	In Space High	6
Dres	Surface Landed	8
Dres	Splashed	1
Dres	Recovered Craft	6
Dres	Space Threshold Altitude	25000
Eeloo	In Space Low	12
Eeloo	In Space High	10
Eeloo	Surface Landed	15
Eeloo	Splashed	1
Eeloo	Recovered Craft	10
Eeloo	Space Threshold Altitude	60000
'''.splitlines()

situations = ['Surface Landed', 'Splashed', 'Flying Low', 'Flying High',
              'Flying Threshold Altitude', 'In Space Low', 'In Space High',
              'Space Threshold Altitude', 'Recovered Craft']
bodies = dict()
for line in lines:
  body,situation,value = line.split('\t')
  if body == 'Sun':
    body = 'Kerbol'
  if body not in bodies:
    bodies[body] = {'Name': body}
  bodies[body][situation] = Decimal(value) 

for i,body in enumerate(['Kerbol', 'Moho', 'Eve', 'Gilly', 'Kerbin', 'Mun',
                         'Minmus', 'Duna', 'Ike', 'Dres', 'Jool', 'Laythe',
                         'Vall', 'Tylo', 'Bop', 'Pol', 'Eeloo']):
  bodies[body]['Rank'] = i

altitude_units = ['m', 'km', 'Mm', 'Gm']
for body in sorted(bodies.itervalues(), key=lambda body: body['Rank']):
  print '|-'
  print '| style="font-weight: bold;" | [[{0}]]'.format(body['Name'])
  for situation in situations:
    if situation not in body:
      print '| style="background-color: silver;" | N/A'
    elif situation == 'Splashed' and body['Splashed'] < body['Surface Landed']:
      print '| style="background-color: silver;" | N/A'
    elif situation.endswith('Threshold Altitude'):
      sort_key = '{0:010n}'.format(body[situation])
      unit_index = 0
      magnitude = body[situation]
      while magnitude >= 1000:
        unit_index += 1
        magnitude /= 1000
      print '| data-sort-value="{0}" | {1} {2}'.format(sort_key, magnitude, altitude_units[unit_index])
    else:
      print '| data-sort-value="{0:04.1f}" | {1}×'.format(body[situation], body[situation])