import sys
import re
import random
from datetime import date
from dateutil.relativedelta import relativedelta

import random
import time
import names

import ships
import people

YEAR_OFFSET = 200

def generate(obj,min,max):
    # Creates an array of objects of given class
    objects = []
    amount = random.randint(min,max)
    for x in range(0, amount):
        objects.append(obj())
    return objects

def romanNumeral(integer):
    returnstring=''
    table=[['M',1000],['CM',900],['D',500],['CD',400],['C',100],['XC',90],['L',50],['XL',40],['X',10],['IX',9],['V',5],['IV',4],['I',1]]
    for pair in table:
        while integer-pair[1]>=0:
            integer-=pair[1]
            returnstring+=pair[0]
    return returnstring

def pickDate():
    start_date = date.today().replace(day=1, month=1).toordinal()
    end_date = date.today().toordinal()
    random_day = date.fromordinal(random.randint(start_date, end_date))
    random_day = random_day + relativedelta(years=YEAR_OFFSET+random.randint(0,100))
    return random_day

def subtractYears(base,amount):
    date = base - relativedelta(years=amount)
    return date

def addYears(base,amount):
    date = base + relativedelta(years=amount)
    return date

def roll(dice):
  result = False
  while (result == False):
    for i in range(0, len(dice)):
      value = random.random()
      if random.random() < dice[i]['chance']:
        result = dice[i]
  return result 

def pick(name):
    module = sys.modules[__name__]
    seperator = '.'

    if(seperator in name):
        # Nested
        parts = name.split(seperator)
        if len(parts) == 2:
            template = random.choice(getattr(module, parts[0])[parts[1]])
        if len(parts) == 3:
            template = random.choice(getattr(module, parts[0])[parts[1]][parts[2]])
        if len(parts) == 4:
            template = random.choice(getattr(module, parts[0])[parts[1]][parts[2]][parts[3]])
    else:
        # Flat
        template = random.choice(getattr(module, name))
    return parse(template)
    
def parse(template):
    module = sys.modules[__name__]
    seperator = '.'

    # Parse template
    if (type(template) == str):        
        tags = re.findall('<.*?>', template)
        rgx = re.compile('[%s]' % '<>')
                
        for tag in tags:
            value = rgx.sub('', tag)

            if(seperator in value):
                # Nested
                parts = value.split(seperator)
                                            
                if len(parts) == 2:
                    value = random.choice(getattr(module, parts[0])[parts[1]])
                if len(parts) == 3:
                    value = random.choice(getattr(module, parts[0])[parts[1]][parts[2]])
                if len(parts) == 4:
                    value = random.choice(getattr(module, parts[0])[parts[1]][parts[2]][parts[3]])    
            else:
                # Flat
                value = random.choice(getattr(module, value))
    
            # Replace the tag with the value
            template = template.replace(tag,value);

    return template


places = {
    "birthplaces" : [
        "<places.qualifier.singular> somewhere in the <astronomy.constellation> system",
        "<places.qualifier.plural> a <places.town> town on <astronomy.planet.name> <astronomy.numeral>",
        "<places.qualifier.plural> the borderlands of the <astronomy.planet.name> outpost on <astronomy.constellation> <astronomy.numeral>",
        "<places.qualifier.singular> a frontier colony on <astronomy.constellation> <astronomy.numeral>",
        "<places.qualifier.singular> a well established colony on <astronomy.planet.name>",
        "<places.qualifier.plural> the <places.type> city of <astronomy.planet.name> on <astronomy.constellation> <astronomy.numeral>",
        "<places.qualifier.plural> the <places.type> city of <astronomy.planet.name>",
        "<places.qualifier.plural> the <places.type> moon of <astronomy.planet.name> in <astronomy.constellation>",
        "<places.qualifier.singular> <astronomy.planet.name> Outpost",
        "<places.qualifier.plural> <astronomy.planet.name> Spaceport",
        "<places.qualifier.singular> <astronomy.planet.name> Starport",
        "<places.qualifier.singular> a listening station on <astronomy.planet.name>",
        "<places.qualifier.singular> a communications relay station on <astronomy.planet.name> <astronomy.numeral>",
        "<places.qualifier.singular> a satellite relay station orbiting <astronomy.planet.name> <astronomy.numeral>",
        "<places.qualifier.singular> an orbital relay station near <astronomy.planet.name> <astronomy.numeral>",
        "<places.qualifier.plural> an outpost on <astronomy.planet.name> <astronomy.numeral>",
        "<places.qualifier.plural> <astronomy.planet.name> City on <astronomy.constellation>",
        "<places.qualifier.plural> <astronomy.planet.name> Colony on <astronomy.constellation>",
        "<places.qualifier.plural> a military base on <astronomy.planet.name> <astronomy.numeral>",
        "<places.qualifier.plural> a shipyard town on <astronomy.planet.name> <astronomy.numeral>",
        "<places.qualifier.plural> the gas mines of <astronomy.planet.name> <astronomy.numeral>",
        "<places.qualifier.plural> The <astronomy.planet.name> Terraform Complex",
        "<places.qualifier.plural> The <astronomy.planet.name> Mining Complex",
        "<places.qualifier.plural> The <astronomy.planet.name> Refinery Complex",
        "<places.qualifier.plural> The <astronomy.planet.name> Industrial Complex",
        "<places.qualifier.plural> the <places.type> city of <astronomy.planet.name> <astronomy.numeral>",
        "<places.qualifier.plural> the largest moon of <astronomy.constellation>",
        "<places.qualifier.plural> the second moon of <astronomy.constellation>",
        "<places.qualifier.plural> a colony on the first moon of <astronomy.planet.name> in the <astronomy.constellation> system",
    ],
    "qualifier" : {
        "singular" : [
            "is originally from",
            "is from",
            "was born on",
            "was raised on ",
        ],
        "plural" : [
            "is originally from",
            "is from",
            "was born in",
            "was raised in",
        ],
    },
    "town" : [
        "",
        "small",
        "fairly small",
        "rural",
        "farming",
        "quiet",
    ],
    "type" : [
        "industrial",
        "military",
        "peaceful",
        "isolated",
        "remote",
        "desert",
        "forest",
        "frozen",
        "cloud",
        "old",
        "ancient",
        "capital",
        "lawless",
    ],
}

astronomy = {
    "planet" : {
        "name" : [
            "Abatos",
            "Abyssus",
            "Achylia",
            "Ackenia",
            "Ackisia",
            "Aeneas",
            "Aesculus",
            "Ageenia",
            "Ageicia",
            "Agricola",
            "Agripeta",
            "Aleania",
            "Alvus",
            "Amethystus",
            "Ampelos",
            "Anchises",
            "Andabata",
            "Angilia",
            "Anusia",
            "Aparctias",
            "Aposplenos",
            "Archimandrita",
            "Arelia",
            "Athesia",
            "Athleta",
            "Athylia",
            "Atomus",
            "Auriga",
            "Awycia",
            "Banilia",
            "Baptista",
            "Belinia",
            "Bubsequa",
            "Caelicola",
            "Canonista",
            "Catoblepas",
            "Cedrus",
            "Celtae",
            "Ceracia",
            "Cerasus",
            "Chaocia",
            "Chausia",
            "Cherronesus",
            "Chersonesus",
            "Clepta",
            "Conlega",
            "Cornus",
            "Cupressus",
            "Danenia",
            "Danista",
            "Delos",
            "Drapeta",
            "Druidae",
            "Drysidae",
            "Echenia",
            "Elminia",
            "Eminia",
            "Emisia",
            "Enalia",
            "Enasia",
            "Enenia",
            "Engasia",
            "Engenia",
            "Enginia",
            "Engolia",
            "Erycia",
            "Erynia",
            "Essonia",
            "Estilia",
            "Estonia",
            "Fagus",
            "Fraxinus",
            "Gagates",
            "Galaxias",
            "Garesia",
            "Garycia",
            "Garynia",
            "Gaster",
            "Hatalia",
            "Hatosia",
            "Hinesia",
            "Hinucia",
            "Hippotoxotae",
            "Honycia",
            "Humus",
            "Iania",
            "Idiota",
            "Idololatres",
            "Ightylia",
            "Ildecia",
            "Ildolia",
            "Imocia",
            "Inaelia",
            "Incola",
            "Itasia",
            "Itonia",
            "Kalalia",
            "Kelesia",
            "Kelinia",
            "Kinocia",
            "Lanista",
            "Laurus",
            "Lesbos",
            "Lyeasia",
            "Lyeosia",
            "Malus",
            "Mandragoras",
            "Matricida",
            "Methodos",
            "Mithras",
            "Moabites",
            "Monticola",
            "Morilia",
            "Morus",
            "Mosisia",
            "Myrtus",
            "Nalania",
            "Nauta",
            "Navita",
            "Neanias",
            "Nyalia",
            "Nyania",
            "Nyesia",
            "Oldulia",
            "Oldycia",
            "Onania",
            "Orisia",
            "Ornus",
            "Orocia",
            "Orolia",
            "Orylia",
            "Osynia",
            "Oughesia",
            "Palaestes",
            "Palmatias",
            "Pampinus",
            "Pandectes",
            "Peltastes",
            "Peracia",
            "Persicus",
            "Pinus",
            "Pirata",
            "Platanus",
            "Poeta",
            "Pololia",
            "Polulia",
            "Populus",
            "Propheta",
            "Prunus",
            "Quaecia",
            "Quaisia",
            "Qualia",
            "Queesia",
            "Radisia",
            "Radysia",
            "Rakelia",
            "Rakolia",
            "Ranenia",
            "Raycia",
            "Rayocia",
            "Rilicia",
            "Rodylia",
            "Ruricola",
            "Rynolia",
            "Sacricola",
            "Sambucus",
            "Samesia",
            "Samisia",
            "Satrapa",
            "Sayalia",
            "Scriba",
            "Seralia",
            "Serilia",
            "Shyalia",
            "Shyocia",
            "Shyunia",
            "Sophistes",
            "Sorites",
            "Sulocia",
            "Sycophanta",
            "Taiosia",
            "Taisia",
            "Tasicia",
            "Tasynia",
            "Tata",
            "Taxus",
            "Telirrhizos",
            "Therulia",
            "Tiaylia",
            "Tonocia",
            "Toralia",
            "Transfuga",
            "Turania",
            "Turynia",
            "Tyrannicida",
            "Tyrus",
            "Untalia",
            "Unticia",
            "Untisia",
            "Untysia",
            "Urnilia",
            "Uskilia",
            "Ustysia",
            "Vannus",
            "Vappa",
            "Verynia",
            "Waresia",
            "Xiphias",
            "Zelotes",
            "Serouos",
            "Risoeos",
            "Vehios",
            "Polatia",
            "Shyayos",
            "Shyeos",
            "Nizeios",
            "Rhaisios",
            "Ineayos",
            "Nyaos",
            "Niateios",
            "Yidios",
            "Cevios",
            "Chrazaos",
            "Rolios",
            "Ustayos",
            "Thrisaos",
            "Baneos",
            "Mofios",
            "Kekeios",
            "Asheos",
            "Luilios",
            "Bureos",
            "Cholaios",
            "Iritia",
            "Torutia",
            "Daulios",
            "Ardaeos",
            "Nalios",
            "Smuryos",
            "Tonetia",
            "Eraos",
            "Ustutia",
            "Dymios",
            "Crevaios",
            "Chudeios",
            "Danuos",
            "Ghaotia",
            "Echeatia",
            "Chaitia",
            "Nubios",
            "Angautia",
            "Kimeitia",
            "Joldios",
            "Dracios",
            "Lanios",
            "Toraitia",
            "Rievios",
            "Blunios",
            "Ceuraos",
            "Leykyios",
            "Drayrios",
            "Whiakios",
            "Tinaeos",
            "Iroios",
            "Ightitia",
            "Whiwios",
            "Featuios",
            "Stoogios",
            "Yeriatia",
            "Yorios",
            "Endyos",
            "Swuiloios",
            "Iautia",
            "Polotia",
            "Undeos",
            "Hoetios",
            "Iauos",
            "Siduos",
            "Carios",
            "Hecoios",
            "Needios",
            "Garaos",
            "Delyos",
            "Smuitios",
            "Ireitia",
            "Aldeos",
            "Deleos",
            "Mosuos",
            "Haucios",
            "Sayloios",
            "Strifuos",
            "Stoukios",
            "Leretia",
            "Hinoutia",
            "Ardeos",
            "Ranatia",
            "Likyos",
            "Engoos",
            "Aldaos",
            "Ardoos",
            "Bitios",
            "Ranaios",
            "Isoios",
            "Aleutia",
            "Stefeos",
            "Loreos",
            "Sonoios",
            "Danoitia",
            "Snodios",
            "Croutoos",
            "Clekios",
            "Snasheios",
            "Pauboios",
            "Tuwios",
            "Voreos",
            "Rynaos",
            "Livios",
            "Danoitia",
            "Ageootia",
            "Issauos",
            "Onotia",
            "Nyhios",
            "Woroos",
            "Higeos",
            "Ardaos",
            "Cheitia",
            "Etitia",
            "Engeytia"
        ],
    },
    "constellation" : [
        "Andromeda",
        "Antlia",
        "Apus",
        "Aquarius",
        "Aquila",
        "Ara",
        "Aries",
        "Auriga",
        "Bootes",
        "Caelum",
        "Camelopardalis",
        "Cancer",
        "Canes",
        "Venatici",
        "Canis",
        "Major",
        "Canis",
        "Minor",
        "Capricornus",
        "Carina",
        "Cassiopeia",
        "Centaurus",
        "Cepheus",
        "Cetus",
        "Chamaeleon",
        "Circinus",
        "Columba",
        "Coma",
        "Berenices",
        "Corona",
        "Australis",
        "Corona",
        "Borealis",
        "Corvus",
        "Crater",
        "Crux",
        "Cygnus",
        "Delphinus",
        "Dorado",
        "Draco",
        "Equuleus",
        "Eridanus",
        "Fornax",
        "Gemini",
        "Grus",
        "Hercules",
        "Horologium",
        "Hydra",
        "Hydrus",
        "Indus",
        "Lacerta",
        "Leo",
        "Leo",
        "Minor",
        "Lepus",
        "Libra",
        "Lupus",
        "Lynx",
        "Lyra",
        "Mensa",
        "Microscopium",
        "Monoceros",
        "Musca",
        "Norma",
        "Octans",
        "Ophiuchus",
        "Orion",
        "Pavo",
        "Pegasus",
        "Perseus",
        "Phoenix",
        "Pictor",
        "Pisces",
        "Piscis",
        "Austrinus",
        "Puppis",
        "Pyxis",
        "Reticulum",
        "Sagitta",
        "Sagittarius",
        "Scorpius",
        "Sculptor",
        "Scutum",
        "Serpens",
        "Sextans",
        "Taurus",
        "Telescopium",
        "Triangulum",
        "Triangulum",
        "Australe",
        "Tucana",
        "Ursa",
        "Major",
        "Ursa",
        "Minor",
        "Vela",
        "Virgo",
        "Volans",
        "Vulpecula"
    ],
    "numeral" : [
        "",
        "Prime",
        "I",
        "II",
        "III",
        "IV",
        "V",
        "VI",
        "VII",
        "VIII",
        "IX",
    ]
}

appearance = {
    "hair" : {
        "color" :   [
            "auburn",
            "black",
            "jet black",
            "blonde",
            "brown",
            "dark brown",
            "dull blonde",
            "golden-blonde",
            "light brown",
            "platinum blonde",
            "red",
            "strawberry blonde"
        ],
        "length" :  [
            "long",
            "mid-length",
            "short",
        ],
        "type" :    [
            "straight",
            "fine",
            "thick",
            "wavy",
            "curly"            
        ],
        "style" : {
            "male" :    [
                "left uncut",
                "cut short",
                "in a butch cut",
                "in a crew cut",
                "in a flattop",
                "cut regular",
                "in a military standard cut",
                "in a military regular cut"
            ],
            "female" :  [
                "neatly braided",
                "cut short",
                "in a <appearance.hair.length> braid",
                "in a <appearance.hair.length> ponytail",
                "left uncut",
                "pinned neatly back",
                "worn <appearance.hair.length>",
                "worn loose about the shoulders"
            ]
        }
    },
    "eyes" : {
        "color" : [
            "blue",
            "brown",
            "dark brown",
            "gray",
            "green",
            "hazel"
        ]
    },
    "skin" : {
        "color" : [
            "pasty",
            "flawless",
            "radiant",
            "dark",
            "deep dark",
            "fair",
            "freckled",
            "pale",
            "olive",
            "dark olive",
            "tanned",
            "rosy"        
        ]
    },
    "build" : {
        "male" : [
            "fit",
            "chubby",
            "attractive",
            "very good looking",
            "quite attractive",
            "somewhat unattractive",
            "portly",
            "angular",
            "skinny",
            "well-built",
            "slender",
            "lean",
            "heavyset",
            "athletic",
            "quite athletic",
            "quite thin",
            "somewhat thin",
            "of average weight",
            "a bit pudgy",
            "quite heavy",
            "fairly muscular",
            "quite muscular"
        ],
        "female" : [
            "fit",
            "thick",
            "attractive",
            "very good looking",
            "quite attractive",
            "somewhat unattractive",
            "plump",
            "shapely",
            "skinny",
            "well-built",
            "slender",
            "lean",
            "heavyset",
            "curvaceous",
            "athletic",
            "quite athletic",
            "quite thin",
            "somewhat thin",
            "of average weight",
            "a bit pudgy",
            "quite heavy",
            "fairly muscular",
            "quite muscular"
        ]
    },
    "height" : [
        "of average height",
        "tall",
        "a little tall",
        "very tall",
        "a little less than average height",
        "short",
        "a little short",
        "very short"
    ]
}

personality = {
    "trait" : {
        "positive" : [
            "accessible",
            "active",
            "adaptable",
            "admirable",
            "adventurous",
            "agreeable",
            "alert",
            "allocentric",
            "amiable",
            "anticipative",
            "appreciative",
            "articulate",
            "aspiring",
            "athletic",
            "attractive",
            "balanced",
            "benevolent",
            "brilliant",
            "calm",
            "capable",
            "captivating",
            "caring",
            "challenging",
            "charismatic",
            "charming",
            "cheerful",
            "clean",
            "clear-headed",
            "clever",
            "colorful",
            "companionly",
            "compassionate",
            "conciliatory",
            "confident",
            "conscientious",
            "considerate",
            "constant",
            "contemplative",
            "cooperative",
            "courageous",
            "courteous",
            "creative",
            "cultured",
            "curious",
            "daring",
            "debonair",
            "decent",
            "decisive",
            "dedicated",
            "deep",
            "dignified",
            "directed",
            "disciplined",
            "discreet",
            "dramatic",
            "dutiful",
            "dynamic",
            "earnest",
            "ebullient",
            "educated",
            "efficient",
            "elegant",
            "eloquent",
            "empathetic",
            "energetic",
            "enthusiastic",
            "esthetic",
            "exciting",
            "extraordinary",
            "fair",
            "faithful",
            "farsighted",
            "felicific",
            "firm",
            "flexible",
            "focused",
            "forecful",
            "forgiving",
            "forthright",
            "freethinking",
            "friendly",
            "fun-loving",
            "gallant",
            "generous",
            "gentle",
            "genuine",
            "good-natured",
            "gracious",
            "hardworking",
            "healthy",
            "hearty",
            "helpful",
            "herioc",
            "high-minded",
            "honest",
            "honorable",
            "humble",
            "humorous",
            "idealistic",
            "imaginative",
            "impressive",
            "incisive",
            "incorruptible",
            "independent",
            "individualistic",
            "innovative",
            "inoffensive",
            "insightful",
            "insouciant",
            "intelligent",
            "intuitive",
            "invulnerable",
            "kind",
            "knowledgeble",
            "leaderly",
            "leisurely",
            "liberal",
            "logical",
            "lovable",
            "loyal",
            "lyrical",
            "magnanimous",
            "many-sided",
            "masculine",
            "mature",
            "methodical",
            "maticulous",
            "moderate",
            "modest",
            "multi-leveled",
            "neat",
            "nonauthoritarian",
            "objective",
            "observant",
            "open",
            "optimistic",
            "orderly",
            "organized",
            "original",
            "painstaking",
            "passionate",
            "patient",
            "patriotic",
            "peaceful",
            "perceptive",
            "perfectionist",
            "personable",
            "persuasive",
            "planful",
            "playful",
            "polished",
            "popular",
            "practical",
            "precise",
            "principled",
            "profound",
            "protean",
            "protective",
            "providential",
            "prudent",
            "punctual",
            "pruposeful",
            "rational",
            "realistic",
            "reflective",
            "relaxed",
            "reliable",
            "resourceful",
            "respectful",
            "responsible",
            "responsive",
            "reverential",
            "romantic",
            "rustic",
            "sage",
            "sane",
            "scholarly",
            "scrupulous",
            "secure",
            "selfless",
            "self-critical",
            "self-defacing",
            "self-denying",
            "self-reliant",
            "self-sufficent",
            "sensitive",
            "sentimental",
            "seraphic",
            "serious",
            "shrewd",
            "simple",
            "skillful",
            "sober",
            "sociable",
            "solid",
            "sophisticated",
            "spontaneous",
            "sporting",
            "stable",
            "steadfast",
            "steady",
            "stoic",
            "strong",
            "studious",
            "suave",
            "subtle",
            "sweet",
            "sympathetic",
            "systematic",
            "tasteful",
            "thorough",
            "tidy",
            "tolerant",
            "tractable",
            "trusting",
            "uncomplaining",
            "understanding",
            "undogmatic",
            "unfoolable",
            "upright",
            "urbane",
            "venturesome",
            "vivacious",
            "warm",
            "well-bred",
            "well-read",
            "well-rounded",
            "winning",
            "wise",
            "witty",
            "youthful",
            "absentminded",
            "aggressive",
            "ambitious",
            "amusing",
        ],
        "neutral" : [
            "artful",
            "ascetic",
            "authoritarian",
            "big-thinking",
            "boyish",
            "breezy",
            "businesslike",
            "busy",
            "casual",
            "crebral",
            "chummy",
            "circumspect",
            "competitive",
            "complex",
            "confidential",
            "conservative",
            "contradictory",
            "crisp",
            "cute",
            "deceptive",
            "determined",
            "dominating",
            "dreamy",
            "driving",
            "droll",
            "dry",
            "earthy",
            "effeminate",
            "emotional",
            "enigmatic",
            "experimental",
            "familial",
            "folksy",
            "formal",
            "freewheeling",
            "frugal",
            "glamorous",
            "guileless",
            "high-spirited",
            "huried",
            "hypnotic",
            "iconoclastic",
            "idiosyncratic",
            "impassive",
            "impersonal",
            "impressionable",
            "intense",
            "invisible",
            "irreligious",
            "irreverent",
            "maternal",
            "mellow",
            "modern",
            "moralistic",
            "mystical",
            "neutral",
            "noncommittal",
            "noncompetitive",
            "obedient",
            "old-fashined",
            "ordinary",
            "outspoken",
            "paternalistic",
            "physical",
            "placid",
            "political",
            "predictable",
            "preoccupied",
            "private",
            "progressive",
            "proud",
            "pure",
            "questioning",
            "quiet",
            "religious",
            "reserved",
            "restrained",
            "retiring",
            "sarcastic",
            "self-conscious",
            "sensual",
            "skeptical",
            "smooth",
            "soft",
            "solemn",
            "solitary",
            "stern",
            "stoiid",
            "strict",
            "stubborn",
            "stylish",
            "subjective",
            "surprising",
            "soft",
            "tough",
            "unaggressive",
            "unambitious",
            "unceremonious",
            "unchanging",
            "undemanding",
            "unfathomable",
            "unhurried",
            "uninhibited",
            "unpatriotic",
            "unpredicatable",
            "unreligious",
            "unsentimental",
            "whimsical"
        ],
        "negitive" : [
            "abrasive",
            "abrupt",
            "agonizing",
            "aimless",
            "airy",
            "aloof",
            "amoral",
            "angry",
            "anxious",
            "apathetic",
            "arbitrary",
            "argumentative",
            "arrogantt",
            "artificial",
            "asocial",
            "assertive",
            "astigmatic",
            "barbaric",
            "bewildered",
            "bizarre",
            "bland",
            "blunt",
            "biosterous",
            "brittle",
            "brutal",
            "calculating",
            "callous",
            "cantakerous",
            "careless",
            "cautious",
            "charmless",
            "childish",
            "clumsy",
            "coarse",
            "cold",
            "colorless",
            "complacent",
            "complaintive",
            "compulsive",
            "conceited",
            "condemnatory",
            "conformist",
            "confused",
            "contemptible",
            "conventional",
            "crafty",
            "crass",
            "crazy",
            "criminal",
            "critical",
            "crude",
            "cruel",
            "cynical",
            "decadent",
            "deceitful",
            "delicate",
            "demanding",
            "dependent",
            "desperate",
            "destructive",
            "devious",
            "difficult",
            "dirty",
            "disconcerting",
            "discontented",
            "discouraging",
            "discourteous",
            "dishonest",
            "disloyal",
            "disobedient",
            "disorganized",
            "disputatious",
            "disrespectful",
            "disruptive",
            "dissolute",
            "dissonant",
            "distractible",
            "disturbing",
            "dogmatic",
            "domineering",
            "dull",
            "easily discouraged",
            "egocentric",
            "enervated",
            "envious",
            "erratic",
            "escapist",
            "excitable",
            "expedient",
            "extravagant",
            "extreme",
            "faithless",
            "false",
            "fanatical",
            "fanciful",
            "fatalistic",
            "fawning",
            "fearful",
            "fickle",
            "fiery",
            "fixed",
            "flamboyant",
            "foolish",
            "forgetful",
            "fraudulent",
            "frightening",
            "frivolous",
            "gloomy",
            "graceless",
            "grand",
            "greedy",
            "grim",
            "gullible",
            "hateful",
            "haughty",
            "hedonistic",
            "hesitant",
            "hidebound",
            "high-handed",
            "hostile",
            "ignorant",
            "imitative",
            "impatient",
            "impractical",
            "imprudent",
            "impulsive",
            "inconsiderate",
            "incurious",
            "indecisive",
            "indulgent",
            "inert",
            "inhibited",
            "insecure",
            "insensitive",
            "insincere",
            "insulting",
            "intolerant",
            "irascible",
            "irrational",
            "irresponsible",
            "irritable",
            "lazy",
            "libidinous",
            "loquacious",
            "malicious",
            "mannered",
            "mannerless",
            "mawkish",
            "mealymouthed",
            "mechanical",
            "meddlesome",
            "melancholic",
            "meretricious",
            "messy",
            "miserable",
            "miserly",
            "misguided",
            "mistaken",
            "money-minded",
            "monstrous",
            "moody",
            "morbid",
            "muddle-headed",
            "naive",
            "narcissistic",
            "narrow",
            "narrow-minded",
            "negativistic",
            "neglectful",
            "neurotic",
            "nihilistic",
            "obnoxious",
            "obsessive",
            "obvious",
            "odd",
            "offhand",
            "one-dimensional",
            "one-sided",
            "opinionated",
            "opportunistic",
            "oppressed",
            "outrageous",
            "overimaginative",
            "paranoid",
            "passive",
            "pedantic",
            "perverse",
            "petty",
            "pharissical",
            "phlegmatic",
            "plodding",
            "pompous",
            "possessive",
            "power-hungry",
            "predatory",
            "prejudiced",
            "presumptuous",
            "pretentious",
            "prim",
            "procrastinating",
            "profligate",
            "provocative",
            "pugnacious",
            "puritanical",
            "quirky",
            "reactionary",
            "reactive",
            "regimental",
            "regretful",
            "repentant",
            "repressed",
            "resentful",
            "ridiculous",
            "rigid",
            "ritualistic",
            "rowdy",
            "ruined",
            "sadistic",
            "sanctimonious",
            "scheming",
            "scornful",
            "secretive",
            "sedentary",
            "selfish",
            "self-indulgent",
            "shallow",
            "shortsighted",
            "shy",
            "silly",
            "single-minded",
            "sloppy",
            "slow",
            "sly",
            "small-thinking",
            "softheaded",
            "sordid",
            "steely",
            "stiff",
            "strong-willed",
            "stupid",
            "submissive",
            "superficial",
            "superstitious",
            "suspicious",
            "tactless",
            "tasteless",
            "tense",
            "thievish",
            "thoughtless",
            "timid",
            "transparent",
            "treacherous",
            "trendy",
            "troublesome",
            "unappreciative",
            "uncaring",
            "uncharitable",
            "unconvincing",
            "uncooperative",
            "uncreative",
            "uncritical",
            "unctuous",
            "undisciplined",
            "unfriendly",
            "ungrateful",
            "unhealthy",
            "unimaginative",
            "unimpressive",
            "unlovable",
            "unpolished",
            "unprincipled",
            "unrealistic",
            "unreflective",
            "unreliable",
            "unrestrained",
            "unself-critical",
            "unstable",
            "vacuous",
            "vague",
            "venal",
            "venomous",
            "vindictive",
            "vulnerable",
            "weak",
            "weak-willed",
            "well-meaning",
            "willful",
            "wishful",
            "zany"
        ]
    }
}

words = {
    "intensity" : [
        "slighly",
        "somewhat",
        "quite",
        "rather",
        "very",
        "strikingly",
        "extremely",
    ]
}

ranks = {
  "enlisted" : [
    {"designation":"E-1","abbrivation":"CA","title":"Crewman Apprentice",           "chance":.043},
    {"designation":"E-2","abbrivation":"CN","title":"Crewman",                      "chance":.053},
    {"designation":"E-3","abbrivation":"SP","title":"Specialist",                   "chance":.180},
    {"designation":"E-4","abbrivation":"PO3","title":"Petty Officer 3rd Class",     "chance":.190},
    {"designation":"E-4","abbrivation":"PO2","title":"Petty Officer 2nd Class",     "chance":.230},
    {"designation":"E-5","abbrivation":"PO1","title":"Petty Officer 1st Class",     "chance":.170},
    {"designation":"E-6","abbrivation":"CPO","title":"Chief Petty Officer",         "chance":.076},
    {"designation":"E-7","abbrivation":"SCPO","title":"Senior Chief Petty Officer", "chance":.021},
    {"designation":"E-8","abbrivation":"MCPO","title":"Master Chief Petty Officer", "chance":.008},
  ] ,
  "officer" : [
    {"designation":"O-1","abbrivation":"ENS","title":"Ensign",                      "chance":.040},
    {"designation":"O-2","abbrivation":"LTJG","title":"Lieutenant Junior Grade",    "chance":.050},
    {"designation":"O-3","abbrivation":"LT","title":"Lieutenant",                   "chance":.300},
    {"designation":"O-4","abbrivation":"LCDR","title":"Lieutenant Commander",       "chance":.100},
    {"designation":"O-5","abbrivation":"CDR","title":"Commander",                   "chance":.050},
    {"designation":"O-6","abbrivation":"CAPT","title":"Captain",                    "chance":.030},
    {"designation":"O-7","abbrivation":"RDML","title":"Rear Admiral (lower half)",  "chance":.003},
    {"designation":"O-8","abbrivation":"RADM","title":"Rear Admiral (upper half)",  "chance":.001},
    {"designation":"O-9","abbrivation":"VADM","title":"Vice Admiral",               "chance":.001},
  ],
  "marine" : [
    {"designation":"E-1","abbrivation":"PVT","title":"Private",            "chance":.043},
    {"designation":"E-2","abbrivation":"PFC","title":"Private First Class","chance":.053},
    {"designation":"E-3","abbrivation":"LCPL","title":"Lance Corporal",    "chance":.120},
    {"designation":"E-4","abbrivation":"CPL","title":"Corporal",           "chance":.080},
    {"designation":"E-5","abbrivation":"SGT","title":"Sergeant",           "chance":.030},
    {"designation":"E-6","abbrivation":"SSGT","title":"Staff Sergeant",    "chance":.020},
    {"designation":"E-7","abbrivation":"GYSSGT","title":"Gunnery Sergeant",    "chance":.010},
    {"designation":"E-8","abbrivation":"MSGT","title":"Master Sergeant",    "chance":.005},
    {"designation":"E-8","abbrivation":"1STSGT","title":"First Sergeant",    "chance":.005},
  ],
  "commander" : [
    {"designation":"O-4","abbrivation":"LCDR","title":"Lieutenant Commander",       "chance":.100},
    {"designation":"O-5","abbrivation":"CDR","title":"Commander",                   "chance":.050},
  ],
  "high ranking officer" : [
    {"designation":"O-6","abbrivation":"CAPT","title": "Captain",                    "chance":.040},
    {"designation":"O-7","abbrivation":"RDML","title": "Admiral",                    "chance":.010},
    {"designation":"O-9","abbrivation":"VADM","title": "Vice Admiral",               "chance":.001},
  ]
}

ship = {
    "type" : [
        {"name" : "Star Carrier",
        "designation" : "CV/CVN",
        "divisions" : ["AD","AMA","A","C","CS","D","E","L","M","MAR","MED","NAV","OPS","PA","NUKE","SAF","SUP","TR","W"]
        },
        {"name" : "Light Star Carrier",
        "designation" : "CVL",
        "divisions" : ["AD","AMA","A","C","CS","D","E","M","MED","NAV","OPS","PA","NUKE","SAF","SUP","TR","W"]
        },
        {"name" : "Escort Star Carrier",
        "designation" : "CVE",
        "divisions" : ["AD","AMA","A","CS","D","E","M","MED","NAV","OPS","PA","NUKE","SAF","SUP","TR","W"]
        },
        {"name" : "Battleship",
        "designation" : "BB",
        "divisions" : ["AD","ART","CS","D","E","M","MED","NAV","OPS","NUKE","SAF","SUP","W"]
        },
        {"name" : "Heavy Gunship",
        "designation" : "GSA",
        "divisions" : ["CS","ART","E","M","NAV","OPS","NUKE","SAF","W"]
        },
        {"name" : "Guided Missile Cruiser",
        "designation" : "CAG/CGN",
        "divisions" : ["AD","CS","D","E","M","MED","NAV","OPS","NUKE","SAF","SUP","TR","W"]
        },
        {"name" : "Heavy Cruiser",
        "designation" : "CA",
        "divisions" : ["AD","CS","D","E","M","MED","NAV","OPS","NUKE","SAF","SUP","TR","W"]
        },
        {"name" : "Light Cruiser",
        "designation" : "CL",
        "divisions" : ["AD","CS","D","E","M","MED","NAV","OPS","NUKE","SAF","SUP","TR","W"]
        },
        {"name" : "Destroyer",
        "designation" : "DD",
        "divisions" : ["AD","CS","D","E","M","MED","NAV","OPS","NUKE","SAF","SUP","TR","W"]
        },
        {"name" : "Guided Missile Destroyer",
        "designation" : "DDG",
        "divisions" : ["AD","CS","D","E","M","MED","NAV","OPS","NUKE","SAF","SUP","TR","W"]
        },
        {"name" : "Destroyer Escort",
        "designation" : "DE",
        "divisions" : ["AD","CS","D","E","M","MED","NAV","OPS","NUKE","SAF","SUP","TR","W"]
        },
        {"name" : "Frigate",
        "designation" : "FF",
        "divisions" : ["AD","CS","D","E","M","MAR","MED","NAV","OPS","NUKE","SAF","SUP","TR","W"]
        },
        {"name" : "Guided Missile Frigate",
        "designation" : "FFG",
        "divisions" : ["AD","CS","D","E","M","MED","NAV","OPS","NUKE","SAF","SUP","TR","W"]
        },
        {"name" : "Ground Combat Ship",
        "designation" : "LCS",
        "divisions" : ["CS","E","M","MED","NAV","OPS","W"]
        },
        {"name" : "Ground Assault Ship",
        "designation" : "LCA",
        "divisions" : ["CS","E","M","MED","NAV","OPS","W","MEU"]
        },
        {"name" : "Guided Missile Prowler",
        "designation" : "SSG/AGSS",
        "divisions" : ["CS","E","M","MED","NAV","OPS","W"]
        },
        {"name" : "Attack Prowler",
        "designation" : "SSN",
        "divisions" : ["CS","E","M","MED","NAV","OPS","W"]
        },
        {"name" : "Ballistic Prowler",
        "designation" : "SSBN",
        "divisions" : ["CS","E","M","MED","NAV","OPS","W"]
        },
        {"name" : "Guided Missile Prowler",
        "designation" : "SSGN",
        "divisions" : ["CS","E","M","MED","NAV","OPS","W"]
        },
        {"name" : "Orbital Assault Ship",
        "designation" : "LHA/LHD",
        "divisions" : ["CS","E","M","NAV","OPS","W"]
        },
        {"name" : "Orbital Command Ship",
        "designation" : "LCC",
        "divisions" : ["AD","AMA","C","CS","COM","D","E","L","M","MED","NAV","OPS","PA","NUKE","SAF","SUP","TR","W"]
        },
        {"name" : "Orbital Transport Dock",
        "designation" : "LPD",
        "divisions" : ["CS","E","M","MED","NAV","OPS","W"]
        },
        {"name" : "Attack / Orbital Cargo Ship",
        "designation" : "AKA/LKA",
        "divisions" : ["CS","E","M","MED","NAV","OPS","W"]
        },
        {"name" : "Dock Landing Ship",
        "designation" : "LSD",
        "divisions" : ["CS","E","MED","NAV","OPS","W"]
        },
        {"name" : "Landing Ship",
        "designation" : "LST",
        "divisions" : ["LS","NAV"]
        },
        {"name" : "Dropship",
        "designation" : "LCM/LCU",
        "divisions" : ["AC","MAR"]
        },
        {"name" : "Mechanized and Utility Dropship",
        "designation" : "LCM/LCU",
        "divisions" : ["AC","GUN","M","MAR"]
        },
        {"name" : "Heavy Assault Dropship",
        "designation" : "LHAC",
        "divisions" : ["AC","GUN","MAR"]
        },
        {"name" : "Oribtal Patrol",
        "designation" : "PC",
        "divisions" : ["CS","NAV","OPS"]
        },
        {"name" : "Patrol Combatant Missile (Suborbital)",
        "designation" : "PHM",
        "divisions" : ["CS","NAV","SAF"]
        },
        {"name" : "Asterioid Minesweeper",
        "designation" : "MSO",
        "divisions" : ["NAV","OPS"]
        },
        {"name" : "Orbital Minehunter",
        "designation" : "MHC",
        "divisions" : ["CS","NAV","OPS"]
        },
        {"name" : "Mine Countermeasures Ship",
        "designation" : "MCM",
        "divisions" : ["CS","NAV","OPS"]
        },
        {"name" : "Mine Countermeasures Support Ship",
        "designation" : "MCS",
        "divisions" : ["CS","NAV","OPS"]
        },
        {"name" : "Ammunition Ship",
        "designation" : "AE",
        "divisions" : ["E","M","NAV","OPS","SUP"]
        },
        {"name" : "Stellar Maintenance Logistics Ship",
        "designation" : "AVB",
        "divisions" : ["E","M","MED","NAV","OPS","SUP"]
        },
        {"name" : "Solar Repair Ship",
        "designation" : "ARC",
        "divisions" : ["D","E","M","NAV","OPS","SUP"]
        },
        {"name" : "Cargo Ship",
        "designation" : "AK",
        "divisions" : ["E","NAV","OPS","SUP"]
        },
        {"name" : "Combat Stores Ship",
        "designation" : "AD",
        "divisions" : ["NAV","OPS","SUP"]
        },
        {"name" : "Command Ship",
        "designation" : "AGF",
        "divisions" : ["AD","AMA","C","CS","D","E","L","M","MAR","MED","NAV","OPS","PA","NUKE","SAF","SUP","TR","W"]
        },
        {"name" : "Communications Relay Ship",
        "designation" : "ACS",
        "divisions" : ["COM","E","NAV","OPS"]
        },
        {"name" : "Destroyer Tender",
        "designation" : "AD",
        "divisions" : ["E","NAV","OPS"]
        },
        {"name" : "Dry Cargo / Ammunition Ship",
        "designation" : "AKE",
        "divisions" : ["NAV","OPS","SUP"]
        },
        {"name" : "Fast Combat Support Ship",
        "designation" : "AOE",
        "divisions" : ["E","M","NAV","OPS","SUP"]
        },
        {"name" : "Stellar Research Ship",
        "designation" : "AGOR",
        "divisions" : ["COM","E","NAV","OPS","MED","SCI"]
        },
        {"name" : "Combat Logistics Ship",
        "designation" : "AO",
        "divisions" : ["E","NAV","OPS","SUP"]
        },
        {"name" : "Fuel Tanker",
        "designation" : "AOG",
        "divisions" : ["SUP","OPS","NAV"]
        },
        {"name" : "Hospital Ship",
        "designation" : "AH",
        "divisions" : ["HOS","NAV","OPS","L"]
        },
        {"name" : "Stellar Surveillance Ship",
        "designation" : "AGOS",
        "divisions" : ["COM","E","NAV","OPS","MED","SCI"]
        },
        {"name" : "Repair Ship",
        "designation" : "AR",
        "divisions" : ["D","E","M","NAV","OPS","MED"]
        },
        {"name" : "Replenishment Oiler",
        "designation" : "AOR",
        "divisions" : ["E","NAV","OPS"]
        },
        {"name" : "Rescue and Salvage Ship",
        "designation" : "ARS",
        "divisions" : ["E","NAV","OPS","SUP"]
        },
        {"name" : "Starport Tender",
        "designation" : "AV",
        "divisions" : ["E","NAV","OPS","SUP"]
        },
        {"name" : "Stores Ship",
        "designation" : "AF",
        "divisions" : ["E","NAV","OPS","SUP"]
        },
        {"name" : "Prowler Rescue Ship",
        "designation" : "ASR",
        "divisions" : ["M","E","NAV","OPS","SUP"]
        },
        {"name" : "Survey Ship",
        "designation" : "AGS",
        "divisions" : ["COM","E","NAV","MED","SRV"]
        },
        {"name" : "Vehicle Cargo Ship",
        "designation" : "AKR",
        "divisions" : ["D","NAV","SUP","OPS"]
        },
        {"name" : "Mobile Landing Platform Ship",
        "designation" : "MLP",
        "divisions" : ["D","E","NAV","SUP","LS"]
        }
    ],
    "division" : {
        "AD" :  { "name" : "Administrative", "size" : 2,           "rank":.2 },
        "AMA" : { "name" : "Spacecraft Maintenance", "size" : 7,   "rank":.1 },
        "ART" : { "name" : "Artillery Crew", "size" : 5,           "rank":.2 },
        "C" :   { "name" : "Chaplain", "size" : 1,               "rank":.8 },
        "CS" :  { "name" : "Combat Systems", "size" : 10,          "rank":.1 },
        "COM" : { "name" : "Communications", "size" : 5,           "rank":.2 },
        "D" :   { "name" : "Deck Department", "size" : 10,         "rank":.0 },
        "E" :   { "name" : "Engineering", "size" : 5,              "rank":.1 },
        "GUN" : { "name" : "Gun Crew", "size" : 1,                 "rank":.2 },
        "L" :   { "name" : "Legal", "size" : 1,                   "rank":.9 },
        "LS" :  { "name" : "Landing Systems", "size" : 3,          "rank":.2 },
        "M" :   { "name" : "Maintenance", "size" : 5,              "rank":.2 },
        "MED" : { "name" : "Medical", "size" : 2,                  "rank":.3 },
        "HOS" : { "name" : "Hospital Staff", "size" : 10,          "rank":.8 },
        "NAV" : { "name" : "Navigation", "size" : 3,               "rank":.2 },
        "NUKE" :{ "name" : "Reactor / FTL", "size" : 6,            "rank":.4 },
        "OPS" : { "name" : "Operations", "size" : 7,               "rank":.3 },
        "PA" :  { "name" : "Public Affairs", "size" : 1,         "rank":.9 },
        "SAF" : { "name" : "Safety", "size" : 3,                   "rank":.2 },
        "SUP" : { "name" : "Supply", "size" : 9,                   "rank":.2 },
        "SRV" : { "name" : "Survey Analysis", "size" : 4,          "rank":.0 },
        "TR" :  { "name" : "Training", "size" : 5,                 "rank":.2 },
        "W" :   { "name" : "Weapons", "size" : 5,                  "rank":.1 },
        "MAR" : { "name" : "Marine Detachment",         "size" : 4, "marines" : True, "rank":.1 },
        "MEU" : { "name" : "Marine Expeditionary Unit", "size" : 24,"marines" : True, "rank":.2 },
        "A" :   { "name" : "Air Wing", "size" : 5, "callsigns" : True,   "rank":1 },
        "AC" :  { "name" : "Air Crew", "size" : 2, "callsigns" : True,   "rank":.3 },
        "SCI" : { "name" : "Astronomy and Astrophysics Department", "size" : 5,   "rank":.6 },
    }
}
