code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Sanford.Multimedia;
using Sanford.Multimedia.Midi;

namespace midi2piano
{
    public partial class Form1 : Form
    {
        [STAThread]
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.Run(new Form1());
        }

        public Form1()
        {
            InitializeComponent();
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Close();
        }

        struct PNote
        {
            public float Length;
            public string Note;

            public PNote(float length, string note)
            {
                Length = length;
                Note = note;
            }

            public static readonly PNote Default = new PNote(0, "");
        }

        private void importMIDIToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (importDlg.ShowDialog(this)
                == System.Windows.Forms.DialogResult.Cancel)
                return;

            List<PNote> notes = new List<PNote>();
            PNote curNote = PNote.Default;
            float tempo = 1;
            float timeSig = 4f;

            // first, we pull midi data
            Sequence s = new Sequence(importDlg.FileName);

            // quickly see if there's a piano track first
            // and get the tempo as well
            int piano = -1;
            for (int it = 0; it < s.Count; it++)
            {
                Track t = s[it];
                foreach (MidiEvent me in t.Iterator())
                {
                    switch (me.MidiMessage.MessageType)
                    {
                        case MessageType.Channel:
                            {
                                ChannelMessage m = (ChannelMessage)me.MidiMessage;
                                if (m.Command == ChannelCommand.ProgramChange)
                                    if ((GeneralMidiInstrument)m.Data1 == GeneralMidiInstrument.AcousticGrandPiano)
                                    {
                                        piano = it;
                                    }
                            }
                            break;
                        case MessageType.Meta:
                            {
                                MetaMessage m = (MetaMessage)me.MidiMessage;
                                if (m.MetaType == MetaType.Tempo)
                                    tempo = (new TempoChangeBuilder(m)).Tempo;
                                else if (m.MetaType == MetaType.TimeSignature)
                                    timeSig = new TimeSignatureBuilder(m).Denominator;
                            }
                            break;
                    }
                    if (piano >= 0)
                        break;
                }
                if (piano >= 0)
                    break;
            }

            // didn't find one, so just try 0th track anyway
            if (piano == -1)
                piano = 0;

            // now, pull all notes (and tempo)
            // and make sure it's a channel that has content
            for (int it = piano; it < s.Count; it++)
            {
                Track t = s[it];

                int delta = 0;
                foreach (MidiEvent me in t.Iterator())
                {
                    delta += me.DeltaTicks;

                    switch (me.MidiMessage.MessageType)
                    {
                        case MessageType.Channel:
                            {
                                ChannelMessage m = (ChannelMessage)me.MidiMessage;
                                switch (m.Command)
                                {
                                    case ChannelCommand.NoteOn:
                                        if (curNote.Note != "")
                                        {
                                            curNote.Length = delta / 1000F;
                                            delta = 0;
                                            notes.Add(curNote);
                                        }

                                        curNote.Note = note2Piano(m.Data1);
                                        break;
                                }
                            }
                            break;
                        case MessageType.Meta:
                            {
                                MetaMessage m = (MetaMessage)me.MidiMessage;
                                if (m.MetaType == MetaType.Tempo)
                                    tempo = (new TempoChangeBuilder(m)).Tempo;
                            }
                            break;
                    }
                }

                // make sure we get last note
                if (curNote.Note != "")
                {
                    curNote.Length = delta / 1000F;
                    notes.Add(curNote);
                }

                // we found a track with content!
                if (notes.Count > 0)
                    break;
            }

            // compress redundant accidentals/octaves
            char[] notemods = new char[7];
            int[] noteocts = new int[7];
            for (int i = 0; i < 7; i++)
            {
                notemods[i] = 'n';
                noteocts[i] = 3;
            }
            for (int i = 0; i < notes.Count; i++)
            {
                string noteStr = notes[i].Note;
                int cur_note = noteStr[0] - 0x41;
                char mod = noteStr[1];
                int oct = int.Parse(noteStr.Substring(2));

                noteStr = noteStr.Substring(0, 1);
                if (mod != notemods[cur_note])
                {
                    noteStr += new string(mod, 1);
                    notemods[cur_note] = mod;
                }
                if (oct != noteocts[cur_note])
                {
                    noteStr += oct.ToString();
                    noteocts[cur_note] = oct;
                }

                notes[i] = new PNote(notes[i].Length, noteStr);
            }

            // now, we find what the "beat" length should be,
            // by counting numbers of times for each length, and finding statistical mode
            Dictionary<float, int> scores = new Dictionary<float, int>();
            foreach (PNote n in notes)
            {
                if (n.Length != 0)
                    if (scores.Keys.Contains(n.Length))
                        scores[n.Length]++;
                    else
                        scores.Add(n.Length, 1);
            }
            float winner = 1;
            int score = 0;
            foreach (KeyValuePair<float, int> kv in scores)
            {
                if (kv.Value > score)
                {
                    winner = kv.Key;
                    score = kv.Value;
                }
            }
            // realign all of them to match beat length
            for (int i = 0; i < notes.Count; i++)
            {
                notes[i] = new PNote(notes[i].Length / winner, notes[i].Note);
            }

            // compress chords down
            for (int i = 0; i < notes.Count; i++)
            {
                if (notes[i].Length == 0 && i < notes.Count - 1)
                {
                    notes[i + 1] = new PNote(notes[i + 1].Length, notes[i].Note + "-" + notes[i + 1].Note);
                    notes.RemoveAt(i);
                    i--;
                }
            }

            // add in time
            for (int i = 0; i < notes.Count; i++)
            {
                float len = notes[i].Length;
                notes[i] = new PNote(len, notes[i].Note + (len != 1 ? "/" + (1 / len).ToString("0.##") : ""));
            }

            // what is the bpm, anyway?
            int rpm = (int)(28800000 / tempo / winner); // 60 * 1,000,000 * .48  the .48 is because note lengths for some reason midi makes the beat note be .48 long

            // now, output!
            string line = "";
            string output = "";
            int lineCount = 1;
            foreach (PNote n in notes)
            {
                if (line.Length + n.Note.Length + 1 > 51)
                {
                    output += line.Substring(0, line.Length - 1) + "\r\n";
                    line = "";
                    if (lineCount == 50)
                        break;
                    lineCount++;
                }
                line += n.Note + ",";
            }
            if (line.Length > 0)
                output += line.Substring(0, line.Length - 1);
            OutputTxt.Text = "BPM: " + rpm.ToString() + "\r\n" + output;
            OutputTxt.SelectAll();
        }

        public enum NoteNames
        {
            C = 0,
            D = 2,
            E = 4,
            F = 5,
            G = 7,
            A = 9,
            B = 11
        }

        string note2Piano(int n)
        {
            string name, arg, octave;
            name = Enum.GetName(typeof(NoteNames), (NoteNames)(n % 12));
            if (name == null)
            {
                name = Enum.GetName(typeof(NoteNames), (NoteNames)((n + 1) % 12));
                arg = "b";
            }
            else
            {
                arg = "n";
            }
            octave = (n / 12 - 1).ToString();

            return name + arg + octave;
        }

        private void copyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OutputTxt.SelectAll();
            OutputTxt.Copy();
        }

        private void halpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show(this,
                "This program prefers MIDIs that have a single track, otherwise it picks the first piano track it finds, else the first track. Songs with odd tempos may have their BPM's calculated wrong.",
                "Halp", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
    }
}


code:
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema

    Version 2.0

    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.

    Example:

    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>

    There are any number of "resheader" rows that contain simple
    name/value pairs.

    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.

    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:

    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.

    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    <value>17, 17</value>
  </metadata>
  <metadata name="importDlg.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    <value>132, 17</value>
  </metadata>
</root>

license: mit


code:
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("midi2piano")]
[assembly: AssemblyProduct("midi2piano")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright ©  2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components.  If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. Only Windows
// assemblies support COM.
[assembly: ComVisible(false)]

// On Windows, the following GUID is for the ID of the typelib if this
// project is exposed to COM. On other platforms, it unique identifies the
// title storage container when deploying this assembly to the device.
[assembly: Guid("9752c562-edc1-40da-8fa1-619df747e0f3")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
[assembly: AssemblyVersion("1.0.0.0")]


code:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>midi2piano</RootNamespace>
    <AssemblyName>midi2piano</AssemblyName>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\x86\Debug</OutputPath>
    <DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <NoStdLib>true</NoStdLib>
    <UseVSHostingProcess>false</UseVSHostingProcess>
    <PlatformTarget>x86</PlatformTarget>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\x86\Release</OutputPath>
    <DefineConstants>TRACE;WINDOWS</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <NoStdLib>true</NoStdLib>
    <UseVSHostingProcess>false</UseVSHostingProcess>
    <PlatformTarget>x86</PlatformTarget>
  </PropertyGroup>
  <PropertyGroup>
    <StartupObject />
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="mscorlib">
      <Private>False</Private>
    </Reference>
    <Reference Include="Sanford.Multimedia.Midi, Version=5.0.0.0, Culture=neutral, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>.\Sanford.Multimedia.Midi.dll</HintPath>
    </Reference>
    <Reference Include="System">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Core">
      <RequiredTargetFramework>4.0</RequiredTargetFramework>
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Xml.Linq">
      <RequiredTargetFramework>4.0</RequiredTargetFramework>
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Net">
      <Private>False</Private>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Form1.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="Form1.Designer.cs">
      <DependentUpon>Form1.cs</DependentUpon>
    </Compile>
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Form1.resx">
      <DependentUpon>Form1.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>


code:
the compiled exe file for the Unstandardness text for DM program is in:
UnstandardnessTestForDM\bin\Debug\UnstandardnessTestForDM.exe
of
UnstandardnessTestForDM\bin\Release\UnstandardnessTestForDM.exe

You have to move it to the root folder (where the dme file is) and run it from there for it to work.


code:
'''
Usage:
    $ python ss13_genchangelog.py [--dry-run] html/changelog.html html/changelogs/

ss13_genchangelog.py - Generate changelog from YAML.

Copyright 2013 Rob "N3X15" Nelson <nexis@7chan.org>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
'''

from __future__ import print_function
import yaml, os, glob, sys, re, time, argparse
from datetime import datetime, date
from time import time

today = date.today()

dateformat = "%d %B %Y"

opt = argparse.ArgumentParser()
opt.add_argument('-d', '--dry-run', dest='dryRun', default=False, action='store_true', help='Only parse changelogs and, if needed, the targetFile. (A .dry_changelog.yml will be output for debugging purposes.)')
opt.add_argument('targetFile', help='The HTML changelog we wish to update.')
opt.add_argument('ymlDir', help='The directory of YAML changelogs we will use.')

args = opt.parse_args()

all_changelog_entries = {}

validPrefixes = [
    'bugfix',
    'wip',
    'tweak',
    'soundadd',
    'sounddel',
    'rscdel',
    'rscadd',
    'imageadd',
    'imagedel',
    'spellcheck',
    'experiment',
    'tgs'
]

def dictToTuples(inp):
    return [(k, v) for k, v in inp.items()]

changelog_cache = os.path.join(args.ymlDir, '.all_changelog.yml')

failed_cache_read = True
if os.path.isfile(changelog_cache):
    try:
        with open(changelog_cache) as f:
            (_, all_changelog_entries) = yaml.load_all(f)
            failed_cache_read = False

            # Convert old timestamps to newer format.
            new_entries = {}
            for _date in all_changelog_entries.keys():
                ty = type(_date).__name__
                # print(ty)
                if ty in ['str', 'unicode']:
                    temp_data = all_changelog_entries[_date]
                    _date = datetime.strptime(_date, dateformat).date()
                    new_entries[_date] = temp_data
                else:
                    new_entries[_date] = all_changelog_entries[_date]
            all_changelog_entries = new_entries
    except Exception as e:
        print("Failed to read cache:")
        print(e, file=sys.stderr)

if args.dryRun:
    changelog_cache = os.path.join(args.ymlDir, '.dry_changelog.yml')

if failed_cache_read and os.path.isfile(args.targetFile):
    from bs4 import BeautifulSoup
    from bs4.element import NavigableString
    print(' Generating cache...')
    with open(args.targetFile, 'r') as f:
        soup = BeautifulSoup(f)
        for e in soup.find_all('div', {'class':'commit'}):
            entry = {}
            date = datetime.strptime(e.h2.string.strip(), dateformat).date()  # key
            for authorT in e.find_all('h3', {'class':'author'}):
                author = authorT.string
                # Strip suffix
                if author.endswith('updated:'):
                    author = author[:-8]
                author = author.strip()

                # Find

                ulT = authorT.next_sibling
                while(ulT.name != 'ul'):
                    ulT = ulT.next_sibling
                changes = []

                for changeT in ulT.children:
                    if changeT.name != 'li': continue
                    val = changeT.decode_contents(formatter="html")
                    newdat = {changeT['class'][0] + '': val + ''}
                    if newdat not in changes:
                        changes += [newdat]

                if len(changes) > 0:
                    entry[author] = changes
            if date in all_changelog_entries:
                all_changelog_entries[date].update(entry)
            else:
                all_changelog_entries[date] = entry

del_after = []
print('Reading changelogs...')
for fileName in glob.glob(os.path.join(args.ymlDir, "*.yml")):
    name, ext = os.path.splitext(os.path.basename(fileName))
    if name.startswith('.'): continue
    if name == 'example': continue
    fileName = os.path.abspath(fileName)
    print(' Reading {}...'.format(fileName))
    cl = {}
    with open(fileName, 'r') as f:
        cl = yaml.load(f)
        f.close()
    if today not in all_changelog_entries:
        all_changelog_entries[today] = {}
    author_entries = all_changelog_entries[today].get(cl['author'], [])
    if len(cl['changes']):
        new = 0
        for change in cl['changes']:
            if change not in author_entries:
                (change_type, _) = dictToTuples(change)[0]
                if change_type not in validPrefixes:
                    print('  {0}: Invalid prefix {1}'.format(fileName, change_type), file=sys.stderr)
                author_entries += [change]
                new += 1
        all_changelog_entries[today][cl['author']] = author_entries
        if new > 0:
            print('  Added {0} new changelog entries.'.format(new))

    if cl.get('delete-after', False):
        if os.path.isfile(fileName):
            if args.dryRun:
                print('  Would delete {0} (delete-after set)...'.format(fileName))
            else:
                del_after += [fileName]

    if args.dryRun: continue

    cl['changes'] = []
    with open(fileName, 'w') as f:
        yaml.dump(cl, f, default_flow_style=False)

targetDir = os.path.dirname(args.targetFile)

with open(args.targetFile.replace('.htm', '.dry.htm') if args.dryRun else args.targetFile, 'w') as changelog:
    with open(os.path.join(targetDir, 'templates', 'header.html'), 'r') as h:
        for line in h:
            changelog.write(line)

    for _date in reversed(sorted(all_changelog_entries.keys())):
        entry_htm = '\n'
        entry_htm += '\t\t\t
{date}
\n'.format(date=_date.strftime(dateformat))
        write_entry = False
        for author in sorted(all_changelog_entries[_date].keys()):
            if len(all_changelog_entries[_date]) == 0: continue
            author_htm = '\t\t\t
{author} updated:
\n'.format(author=author)
            author_htm += '\t\t\t
\n'
            changes_added = []
            for (css_class, change) in (dictToTuples(e)[0] for e in all_changelog_entries[_date][author]):
                if change in changes_added: continue
                write_entry = True
                changes_added += [change]
                author_htm += '\t\t\t\t
{change}
\n'.format(css_class=css_class, change=change.strip())
            author_htm += '\t\t\t
\n'
            if len(changes_added) > 0:
                entry_htm += author_htm
        if write_entry:
            changelog.write(entry_htm)

    with open(os.path.join(targetDir, 'templates', 'footer.html'), 'r') as h:
        for line in h:
            changelog.write(line)

with open(changelog_cache, 'w') as f:
    cache_head = 'DO NOT EDIT THIS FILE BY HAND!  AUTOMATICALLY GENERATED BY ss13_genchangelog.py.'
    yaml.dump_all([cache_head, all_changelog_entries], f, default_flow_style=False)

if len(del_after):
    print('Cleaning up...')
    for fileName in del_after:
        if os.path.isfile(fileName):
            print(' Deleting {0} (delete-after set)...'.format(fileName))
            os.remove(fileName)


code:
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
#  Usually these files are written by a python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject

# Start.tw
src/config/start.tw

repo_name: deswes/fc

path: .gitignore


code:
# Ignore everything in this directory
*
# Except this file
!.gitignore


code:
#!/bin/bash

# Will add all *.tw files to StoryIncludes.
rm src/config/start.tw
cp src/config/start.tw.proto start.tw.tmp
find src -name '*.tw' -print >>start.tw.tmp
mv start.tw.tmp src/config/start.tw

HASH=`git log -n1 |grep commit | sed 's/commit //'`

./devTools/tweeGo/tweego -o bin/FC_pregmod.html src/config/start.tw

rm src/config/start.tw

path: compile


code:
#!/bin/bash

# Will add all *.tw files to StoryIncludes.
rm src/config/start.tw
cp src/config/start.tw.proto start.tw.tmp
find src -name '*.tw' -print >>start.tw.tmp
mv start.tw.tmp src/config/start.tw

HASH=`git log -n1 |grep -m1 commit | sed 's/commit //'`

./devTools/tweeGo/tweego -o bin/FC_pregmod_$HASH.html src/config/start.tw

rm src/config/start.tw

echo "FC_pregmod_$HASH.html" compilation finished.

path: compile-git


code:
@echo off
:: Free Cities Basic Compiler - Windows x86_64

:: Will add all *.tw files to StoryIncludes.
del src\config\start.tw
copy src\config\start.tw.proto start.tw.tmp >nul
>>start.tw.tmp (for /r "src" %%F in (*.tw) do echo %%F)
move start.tw.tmp src\config\start.tw >nul

CALL "%~dp0devTools\tweeGo\tweego.exe" -o "%~dp0bin/FC_pregmod.html" "%~dp0src\config\start.tw"

del src\config\start.tw
ECHO Done


code:
@echo off
:: Free Cities Basic Compiler - Windows x86_64
:: Will wait for keypress before terminating.

:: Will add all *.tw files to StoryIncludes.
del src\config\start.tw
copy src\config\start.tw.proto start.tw.tmp >nul
>>start.tw.tmp (for /r "src" %%F in (*.tw) do echo %%F)
move start.tw.tmp src\config\start.tw >nul

CALL "%~dp0devTools\tweeGo\tweego.exe" -o "%~dp0bin/FC_pregmod.html" "%~dp0src\config\start.tw"

del src\config\start.tw

ECHO Done
PAUSE


code:
:: slave generation widgets [nobr]

<<widget "NationalityToRace">>

<<if $fixedRace == 0>>

<<if ($activeSlave.nationality is "American")>>
	<<set $activeSlave.race to either("black", "middle eastern", "white", "white", "white", "latina", "latina", "asian", "amerindian", "mixed race")>>
<<elseif ($activeSlave.nationality is "Canadian")>>
	<<set $activeSlave.race to either("white", "white", "white", "white", "amerindian")>>
<<elseif ($activeSlave.nationality is "Puerto Rican")>>
	<<set $activeSlave.race to either("latina")>>
<<elseif ($activeSlave.nationality is "Cuban")>>
	<<set $activeSlave.race to either("latina", "black")>>
<<elseif ($activeSlave.nationality is "Haitian")>>
	<<set $activeSlave.race to either("black")>>
<<elseif ($activeSlave.nationality is "Jamaican")>>
	<<set $activeSlave.race to either("black")>>
<<elseif ($activeSlave.nationality is "Mexican")>>
	<<set $activeSlave.race to either("latina", "latina", "latina", "latina", "latina", "amerindian")>>
<<elseif ($activeSlave.nationality is "Dominican")>>
	<<set $activeSlave.race to either("mixed race", "mixed race", "mixed race", "mixed race", "mixed race", "mixed race", "mixed race", "white", "white", "black")>>
<<elseif ($activeSlave.nationality is "Peruvian")>>
	<<set $activeSlave.race to either("latina", "amerindian")>>
<<elseif ($activeSlave.nationality is "Venezuelan")>>
	<<set $activeSlave.race to either("latina")>>
<<elseif ($activeSlave.nationality is "Bolivian")>>
	<<set $activeSlave.race to either("latina", "amerindian")>>
<<elseif ($activeSlave.nationality is "Guatemalan")>>
	<<set $activeSlave.race to either("latina", "amerindian")>>
<<elseif ($activeSlave.nationality is "Brazilian")>>
	<<set $activeSlave.race to either("black", "latina", "mixed race", "mixed race", "amerindian", "white")>>
<<elseif ($activeSlave.nationality is "Argentinian")>>
	<<set $activeSlave.race to either("white", "latina", "latina")>>
<<elseif ($activeSlave.nationality is "Chilean")>>
	<<set $activeSlave.race to either("white", "latina", "latina", "latina")>>
<<elseif ($activeSlave.nationality is "Colombian")>>
	<<set $activeSlave.race to either("latina")>>
<<elseif ($activeSlave.nationality is "Egyptian")>>
	<<set $activeSlave.race to either("black", "middle eastern", "middle eastern", "middle eastern", "semitic")>>
<<elseif ($activeSlave.nationality is "Turkish")>>
	<<set $activeSlave.race to either("middle eastern", "middle eastern", "middle eastern", "semitic")>>
<<elseif ($activeSlave.nationality is "Iranian")>>
	<<set $activeSlave.race to either("indo-aryan", "indo-aryan", "indo-aryan", "semitic")>>
<<elseif ($activeSlave.nationality is "Armenian")>>
	<<set $activeSlave.race to either("indo-aryan", "semitic")>>
<<elseif ($activeSlave.nationality is "Israeli")>>
	<<set $activeSlave.race to either("white", "middle eastern", "semitic", "semitic")>>
<<elseif ($activeSlave.nationality is "Saudi")>>
	<<set $activeSlave.race to either("black", "asian", "middle eastern", "middle eastern")>>
<<elseif ($activeSlave.nationality is "Moroccan")>>
	<<set $activeSlave.race to either("middle eastern", "middle eastern", "black")>>
<<elseif ($activeSlave.nationality is "Nigerian")>>
	<<set $activeSlave.race to either("black")>>
<<elseif ($activeSlave.nationality is "Kenyan")>>
	<<set $activeSlave.race to either("black")>>
<<elseif ($activeSlave.nationality is "Zimbabwean")>>
	<<set $activeSlave.race to either("black", "black", "black", "black", "white")>>
<<elseif ($activeSlave.nationality is "Ugandan")>>
	<<set $activeSlave.race to either("black")>>
<<elseif ($activeSlave.nationality is "Tanzanian")>>
	<<set $activeSlave.race to either("black", "black", "black", "semitic")>>
<<elseif ($activeSlave.nationality is "Ghanan")>>
	<<set $activeSlave.race to either("black", "black", "black", "semitic")>>
<<elseif ($activeSlave.nationality is "Congolese")>>
	<<set $activeSlave.race to either("black")>>
<<elseif ($activeSlave.nationality is "Ethiopian")>>
	<<set $activeSlave.race to either("black", "black", "black", "middle eastern", "semitic")>>
<<elseif ($activeSlave.nationality is "South African")>>
	<<set $activeSlave.race to either("black", "black", "black", "white")>>
<<elseif ($activeSlave.nationality is "Chinese")>>
	<<set $activeSlave.race to either("asian")>>
<<elseif ($activeSlave.nationality is "Korean")>>
	<<set $activeSlave.race to either("asian")>>
<<elseif ($activeSlave.nationality is "Japanese")>>
	<<set $activeSlave.race to either("asian")>>
<<elseif ($activeSlave.nationality is "Thai")>>
	<<set $activeSlave.race to either("asian", "asian", "malay")>>
<<elseif ($activeSlave.nationality is "Vietnamese")>>
	<<set $activeSlave.race to either("asian")>>
<<elseif ($activeSlave.nationality is "Indonesian")>>
	<<set $activeSlave.race to either("asian", "malay", "malay", "pacific islander")>>
<<elseif ($activeSlave.nationality is "Filipina")>>
	<<set $activeSlave.race to either("asian", "malay", "malay", "pacific islander")>>
<<elseif ($activeSlave.nationality is "Burmese")>>
	<<set $activeSlave.race to either("asian", "asian", "indo-aryan")>>
<<elseif ($activeSlave.nationality is "Nepalese")>>
	<<set $activeSlave.race to either("asian", "asian", "indo-aryan")>>
<<elseif ($activeSlave.nationality is "Uzbek")>>
	<<set $activeSlave.race to either("asian")>>
<<elseif ($activeSlave.nationality is "Afghan")>>
	<<set $activeSlave.race to either("indo-aryan", "middle eastern")>>
<<elseif ($activeSlave.nationality is "Algerian")>>
	<<set $activeSlave.race to either("middle eastern")>>
<<elseif ($activeSlave.nationality is "Libyan")>>
	<<set $activeSlave.race to either("middle eastern")>>
<<elseif ($activeSlave.nationality is "Tunisian")>>
	<<set $activeSlave.race to either("middle eastern")>>
<<elseif ($activeSlave.nationality is "Lebanese")>>
	<<set $activeSlave.race to either("middle eastern", "semitic")>>
<<elseif ($activeSlave.nationality is "Jordanian")>>
	<<set $activeSlave.race to either("middle eastern", "semitic")>>
<<elseif ($activeSlave.nationality is "Emirati")>>
	<<set $activeSlave.race to either("middle eastern", "indo-aryan")>>
<<elseif ($activeSlave.nationality is "Omani")>>
	<<set $activeSlave.race to either("middle eastern", "indo-aryan")>>
<<elseif ($activeSlave.nationality is "Malian")>>
	<<set $activeSlave.race to either("black", "black", "black", "black", "black", "middle eastern")>>
<<elseif ($activeSlave.nationality is "Sudanese")>>
	<<set $activeSlave.race to either("black", "black", "black", "middle eastern")>>
<<elseif ($activeSlave.nationality is "Yemeni")>>
	<<set $activeSlave.race to either("black", "semitic", "middle eastern", "middle eastern", "middle eastern")>>
<<elseif ($activeSlave.nationality is "Iraqi")>>
	<<set $activeSlave.race to either("semitic", "middle eastern", "middle eastern", "middle eastern", "middle eastern")>>
<<elseif ($activeSlave.nationality is "Indian")>>
	<<set $activeSlave.race to either("indo-aryan")>>
<<elseif ($activeSlave.nationality is "Malaysian")>>
	<<set $activeSlave.race to either("asian", "malay", "malay", "malay")>>
<<elseif ($activeSlave.nationality is "Kazakh")>>
	<<set $activeSlave.race to either("asian", "asian", "asian", "semitic", "indo-aryan")>>
<<elseif ($activeSlave.nationality is "Pakistani")>>
	<<set $activeSlave.race to either("indo-aryan", "indo-aryan", "indo-aryan", "semitic")>>
<<elseif ($activeSlave.nationality is "Bangladeshi")>>
	<<set $activeSlave.race to either("indo-aryan")>>
<<elseif ($activeSlave.nationality is "Belarusian")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Russian")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Ukrainian")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Irish")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Icelandic")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Finnish")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Swiss")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Danish")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Norwegian")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Austrian")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Slovak")>>
	<<set $activeSlave.race to either("white", "white", "white", "white", "indo-aryan")>>
<<elseif ($activeSlave.nationality is "Dutch")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Belgian")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Czech")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Serbian")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Portuguese")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Hungarian")>>
	<<set $activeSlave.race to either("white", "white", "white", "white", "indo-aryan")>>
<<elseif ($activeSlave.nationality is "Estonian")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Polish")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Lithuanian")>>
	<<set $activeSlave.race to either("white")>>
<<elseif ($activeSlave.nationality is "Romanian")>>
	<<set $activeSlave.race to either("semitic", "white", "white", "white", "white", "indo-aryan")>>
<<elseif ($activeSlave.nationality is "German")>>
	<<set $activeSlave.race to either("black", "middle eastern", "white", "white", "white", "white", "white", "white")>>
<<elseif ($activeSlave.nationality is "Swedish")>>
	<<set $activeSlave.race to either("middle eastern", "white", "white", "white", "white")>>
<<elseif ($activeSlave.nationality is "French")>>
	<<set $activeSlave.race to either("black", "middle eastern", "white", "white", "white", "white", "white", "southern European")>>
<<elseif ($activeSlave.nationality is "Italian")>>
	<<set $activeSlave.race to either("middle eastern", "southern European", "southern European", "white", "white")>>
<<elseif ($activeSlave.nationality is "Greek")>>
	<<set $activeSlave.race to either("southern European")>>
<<elseif ($activeSlave.nationality is "Spanish")>>
	<<set $activeSlave.race to either("semitic", "southern European", "southern European")>>
<<elseif ($activeSlave.nationality is "British")>>
	<<set $activeSlave.race to either("indo-aryan", "white", "white", "white", "white", "white", "white", "white", "white", "white")>>
<<elseif ($activeSlave.nationality is "Scottish")>>
	<<set $activeSlave.race to either("middle eastern", "indo-aryan", "white", "white", "white", "white", "white", "white", "white")>>
<<elseif ($activeSlave.nationality is "Australian")>>
	<<set $activeSlave.race to either("white", "white", "black", "asian")>>
<<elseif ($activeSlave.nationality is "a New Zealander")>>
	<<set $activeSlave.race to either("white", "white", "white", "white", "pacific islander")>>
<</if>>

/% Begin mixed race rate adjustment. %/
/% Some countries are extremely ethnically homogeneous and unlikely to change soon. %/
<<if ($activeSlave.nationality is "Japanese")>>
	<<if random(1,100) > 98>>
		<<set $activeSlave.race to "mixed race">>
	<</if>>
<<elseif ($activeSlave.nationality is "Korean")>>
	<<if random(1,100) > 95>>
		<<set $activeSlave.race to "mixed race">>
	<</if>>
<<elseif ($activeSlave.nationality is "Polish") or ($activeSlave.nationality is "Romanian") or ($activeSlave.nationality is "Bulgarian") or ($activeSlave.nationality is "Lithuanian") or ($activeSlave.nationality is "Croatian")>>
	/% Croatia isn't an origin currently but the game might add it in the future. %/
	<<if random(1,100) > 98>>
		<<set $activeSlave.race to "mixed race">>
	<</if>>
<<elseif random(1,100) > 90>>
	/% Default rate. %/
	<<set $activeSlave.race to "mixed race">>
<</if>>
/% End mixed race rate adjustment. %/

<<else>>

<<switch $fixedRace>>
<<case "white">>
	<<set $activeSlave.nationality to $whiteNationalities.random()>>
<<case "asian">>
	<<set $activeSlave.nationality to $asianNationalities.random()>>
<<case "latina">>
	<<set $activeSlave.nationality to $latinaNationalities.random()>>
<<case "middle eastern">>
	<<set $activeSlave.nationality to $middleEasternNationalities.random()>>
<<case "black">>
	<<set $activeSlave.nationality to $blackNationalities.random()>>
<<case "indo-aryan">>
	<<set $activeSlave.nationality to $indoAryan"Nationalities.random()>>
<<case "pacific islander">>
	<<set $activeSlave.nationality to $pacificIslanderNationalities.random()>>
<<case "malay">>
	<<set $activeSlave.nationality to $malayNationalities.random()>>
<<case "amerindian">>
	<<set $activeSlave.nationality to $amerindianNationalities.random()>>
<<case "southern european">>
	<<set $activeSlave.nationality to $southernEuropean"Nationalities.random()>>
<<case "semitic">>
	<<set $activeSlave.nationality to $semiticNationalities.random()>>
<</switch>>
<<set $activeSlave.race = $fixedRace>>

<</if>>

<<if $arcologies[0].FSSupremacistLawME != 0>>
<<if $activeSlave.race == $arcologies[0].FSSupremacistRace>>
	<<set $activeSlave.race to "mixed race">>
<</if>>
<</if>>

<</widget>>

<<widget "NationalityToName">>

<<if ($activeSlave.nationality is "American")>>
	<<if $activeSlave.race is "black">>
		<<set $activeSlave.birthName to $africanAmericanSlaveNames.random()>>
	<<elseif $activeSlave.race is "latina">>
		<<set $activeSlave.birthName to $latinaSlaveNames.random()>>
	<<elseif $activeSlave.race is "asian">>
		<<set $activeSlave.birthName to $asianAmericanSlaveNames.random()>>
	<<elseif $activeSlave.race is "middle eastern">>
		<<set $activeSlave.birthName to $egyptianSlaveNames.random()>>
	<<else>>
		<<set $activeSlave.birthName to $whiteAmericanSlaveNames.random()>>
	<</if>>
<<case "Canadian">>
	<<set $activeSlave.birthName to $canadianSlaveNames.random()>>
<<case "Mexican">>
	<<set $activeSlave.birthName to $mexicanSlaveNames.random()>>
<<case "Dominican">>
	<<set $activeSlave.birthName to $dominicanSlaveNames.random()>>
<<case "Puerto Rican">>
	<<set $activeSlave.birthName to $puertoRicanSlaveNames.random()>>
<<case "Haitian">>
	<<set $activeSlave.birthName to $haitianSlaveNames.random()>>
<<case "Jamaican">>
	<<set $activeSlave.birthName to $jamaicanSlaveNames.random()>>
<<case "Cuban">>
	<<set $activeSlave.birthName to $cubanSlaveNames.random()>>
<<case "Guatemalan">>
	<<set $activeSlave.birthName to $guatemalanSlaveNames.random()>>
<<case "Chilean">>
	<<set $activeSlave.birthName to $chileanSlaveNames.random()>>
<<case "Peruvian">>
	<<set $activeSlave.birthName to $peruvianSlaveNames.random()>>
<<case "Bolivian">>
	<<set $activeSlave.birthName to $bolivianSlaveNames.random()>>
<<case "Venezuelan">>
	<<set $activeSlave.birthName to $venezuelanSlaveNames.random()>>
<<case "Belarusian">>
	<<set $activeSlave.birthName to $belarusianSlaveNames.random()>>
<<case "Russian">>
	<<set $activeSlave.birthName to $russianSlaveNames.random()>>
<<case "Ukrainian">>
	<<set $activeSlave.birthName to $ukrainianSlaveNames.random()>>
<<case "Italian">>
	<<set $activeSlave.birthName to $italianSlaveNames.random()>>
<<case "Spanish">>
	<<set $activeSlave.birthName to $spanishSlaveNames.random()>>
<<case "British">>
	<<set $activeSlave.birthName to $britishSlaveNames.random()>>
<<case "Scottish">>
	<<set $activeSlave.birthName to $scottishSlaveNames.random()>>
<<case "French">>
	<<set $activeSlave.birthName to $frenchSlaveNames.random()>>
<<case "German">>
	<<set $activeSlave.birthName to $germanSlaveNames.random()>>
<<case "Lithuanian">>
	<<set $activeSlave.birthName to $lithuanianSlaveNames.random()>>
<<case "Norwegian">>
	<<set $activeSlave.birthName to $norwegianSlaveNames.random()>>
<<case "Slovak">>
	<<set $activeSlave.birthName to $slovakSlaveNames.random()>>
<<case "Danish">>
	<<set $activeSlave.birthName to $danishSlaveNames.random()>>
<<case "Dutch">>
	<<set $activeSlave.birthName to $dutchSlaveNames.random()>>
<<case "Austrian">>
	<<set $activeSlave.birthName to $austrianSlaveNames.random()>>
<<case "Swiss">>
	<<set $activeSlave.birthName to $swissSlaveNames.random()>>
<<case "Serbian">>
	<<set $activeSlave.birthName to $serbianSlaveNames.random()>>
<<case "Belgian">>
	<<set $activeSlave.birthName to $belgianSlaveNames.random()>>
<<case "Czech">>
	<<set $activeSlave.birthName to $czechSlaveNames.random()>>
<<case "Portuguese">>
	<<set $activeSlave.birthName to $portugueseSlaveNames.random()>>
<<case "Swedish">>
	<<set $activeSlave.birthName to $swedishSlaveNames.random()>>
<<case "Romanian">>
	<<set $activeSlave.birthName to $romanianSlaveNames.random()>>
<<case "Hungarian">>
	<<set $activeSlave.birthName to $hungarianSlaveNames.random()>>
<<case "Estonian">>
	<<set $activeSlave.birthName to $estonianSlaveNames.random()>>
<<case "Irish">>
	<<set $activeSlave.birthName to $irishSlaveNames.random()>>
<<case "Icelandic">>
	<<set $activeSlave.birthName to $icelandicSlaveNames.random()>>
<<case "Finnish">>
	<<set $activeSlave.birthName to $finnishSlaveNames.random()>>
<<case "Greek">>
	<<set $activeSlave.birthName to $greekSlaveNames.random()>>
<<case "Polish">>
	<<set $activeSlave.birthName to $polishSlaveNames.random()>>
<<case "Brazilian">>
	<<set $activeSlave.birthName to $brazilianSlaveNames.random()>>
<<case "Egyptian">>
	<<set $activeSlave.birthName to $egyptianSlaveNames.random()>>
<<case "Colombian">>
	<<set $activeSlave.birthName to $colombianSlaveNames.random()>>
<<case "Argentinian">>
	<<set $activeSlave.birthName to $argentinianSlaveNames.random()>>
<<case "Turkish">>
	<<set $activeSlave.birthName to $turkishSlaveNames.random()>>
<<case "Iranian">>
	<<set $activeSlave.birthName to $iranianSlaveNames.random()>>
<<case "Armenian">>
	<<set $activeSlave.birthName to $armenianSlaveNames.random()>>
<<case "Israeli">>
	<<set $activeSlave.birthName to $israeliSlaveNames.random()>>
<<case "Saudi">>
	<<set $activeSlave.birthName to $saudiSlaveNames.random()>>
<<case "South African">>
	<<if $activeSlave.race is "black">>
		<<set $activeSlave.birthName to $blackSouthAfricanSlaveNames.random()>>
	<<else>>
		<<set $activeSlave.birthName to $whiteSouthAfricanSlaveNames.random()>>
	<</if>>
<<case "Nigerian">>
	<<set $activeSlave.birthName to $nigerianSlaveNames.random()>>
<<case "Congolese">>
	<<set $activeSlave.birthName to $congoleseSlaveNames.random()>>
<<case "Kenyan">>
	<<set $activeSlave.birthName to $kenyanSlaveNames.random()>>
<<case "Tanzanian">>
	<<set $activeSlave.birthName to $tanzanianSlaveNames.random()>>
<<case "Zimbabwean">>
	<<if $activeSlave.race == "white">>
		<<set $activeSlave.birthName to $britishSlaveNames.random()>>
	<<else>>
		<<set $activeSlave.birthName to $zimbabweanSlaveNames.random()>>
	<</if>>
<<case "Ghanan">>
	<<set $activeSlave.birthName to $ghananSlaveNames.random()>>
<<case "Ugandan">>
	<<set $activeSlave.birthName to $ugandanSlaveNames.random()>>
<<case "Ethiopian">>
	<<set $activeSlave.birthName to $ethiopianSlaveNames.random()>>
<<case "Moroccan">>
	<<set $activeSlave.birthName to $moroccanSlaveNames.random()>>
<<case "Chinese">>
	<<set $activeSlave.birthName to $chineseSlaveNames.random()>>
<<case "Korean">>
	<<set $activeSlave.birthName to $koreanSlaveNames.random()>>
<<case "Thai">>
	<<set $activeSlave.birthName to $thaiSlaveNames.random()>>
<<case "Vietnamese">>
	<<set $activeSlave.birthName to $vietnameseSlaveNames.random()>>
<<case "Japanese">>
	<<set $activeSlave.birthName to $japaneseSlaveNames.random()>>
<<case "Indonesian">>
	<<set $activeSlave.birthName to $indonesianSlaveNames.random()>>
<<case "Filipina">>
	<<set $activeSlave.birthName to $filipinaSlaveNames.random()>>
<<case "Bangladeshi">>
	<<set $activeSlave.birthName to $bangladeshiSlaveNames.random()>>
<<case "Malaysian">>
	<<set $activeSlave.birthName to $malaysianSlaveNames.random()>>
<<case "Uzbek">>
	<<set $activeSlave.birthName to $uzbekSlaveNames.random()>>
<<case "Afghan">>
	<<set $activeSlave.birthName to $afghanSlaveNames.random()>>
<<case "Nepalese">>
	<<set $activeSlave.birthName to $nepaleseSlaveNames.random()>>
<<case "Burmese">>
	<<set $activeSlave.birthName to $burmeseSlaveNames.random()>>
<<case "Iraqi">>
	<<set $activeSlave.birthName to $iraqiSlaveNames.random()>>
<<case "Yemeni">>
	<<set $activeSlave.birthName to $yemeniSlaveNames.random()>>
<<case "Sudanese">>
	<<set $activeSlave.birthName to $sudaneseSlaveNames.random()>>
<<case "Algerian">>
	<<set $activeSlave.birthName to $algerianSlaveNames.random()>>
<<case "Tunisian">>
	<<set $activeSlave.birthName to $tunisianSlaveNames.random()>>
<<case "Libyan">>
	<<set $activeSlave.birthName to $libyanSlaveNames.random()>>
<<case "Omani">>
	<<set $activeSlave.birthName to $omaniSlaveNames.random()>>
<<case "Malian">>
	<<set $activeSlave.birthName to $malianSlaveNames.random()>>
<<case "Jordanian">>
	<<set $activeSlave.birthName to $jordanianSlaveNames.random()>>
<<case "Lebanese">>
	<<set $activeSlave.birthName to $lebaneseSlaveNames.random()>>
<<case "Emirati">>
	<<set $activeSlave.birthName to $emiratiSlaveNames.random()>>
<<case "Kazakh">>
	<<set $activeSlave.birthName to $kazakhSlaveNames.random()>>
<<case "Pakistani">>
	<<set $activeSlave.birthName to $pakistaniSlaveNames.random()>>
<<case "Indian">>
	<<set $activeSlave.birthName to $indianSlaveNames.random()>>
<<case "Australian">>
	<<set $activeSlave.birthName to $australianSlaveNames.random()>>
<<case "a New Zealander">>
	<<set $activeSlave.birthName to $newZealanderSlaveNames.random()>>
<<default>>
	<<set $activeSlave.birthName to $whiteAmericanSlaveNames.random()>>
<</switch>>

<</widget>>

<<widget "NationalityToAccent">>

<<set $seed to either(0,1,1,2,2,2,3,3,3,3)>>

<<if ($activeSlave.nationality is "American")>>
	<<if $activeSlave.race is "black">>
	<<if $language is "English">>
		<<set $activeSlave.accent to 0>>
	<<else>>
		<<set $activeSlave.accent to either(0,1,1,2,2,2,3,3,3,3)>>
	<</if>>
	<<elseif $activeSlave.race is "latina">>
	<<if $language is "English">>
		<<set $activeSlave.accent to 0>>
	<<elseif $language is "Spanish">>
		<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
		<<set $activeSlave.accent to $seed>>
	<</if>>
	<<elseif $activeSlave.race is "asian">>
	<<if $language is "English">>
		<<set $activeSlave.accent to 0>>
	<<elseif $language is "Chinese">>
		<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
		<<set $activeSlave.accent to $seed>>
	<</if>>
	<<elseif $activeSlave.race is "middle eastern">>
	<<if $language is "English">>
		<<set $activeSlave.accent to 0>>
	<<elseif $language is "Arabic">>
		<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
		<<set $activeSlave.accent to $seed>>
	<</if>>
	<<else>>
	<<if $language is "English">>
		<<set $activeSlave.accent to 0>>
	<<else>>
		<<set $activeSlave.accent to $seed>>
	<</if>>
	<</if>>
<<elseif ($activeSlave.nationality is "Canadian")>>
	<<if $language is "English">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Mexican")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Dominican")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Puerto Rican")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Haitian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Jamaican")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Cuban")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Guatemalan")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Chilean")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Peruvian")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Bolivian")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Venezuelan")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Russian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Ukrainian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Italian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Spanish")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "British")>>
	<<if $language is "English">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Scottish")>>
	<<if $language is "English">>
	<<set $activeSlave.accent to 2>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "French")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "German")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Lithuanian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Belarusian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "French")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "German")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Lithuanian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Norwegian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Slovak")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Danish")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Dutch")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Austrian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Swiss")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Serbian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Belgian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Czech")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Portuguese")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Swedish")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Romanian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Hungarian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Estonian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Irish")>>
	<<if $language is "English">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Icelandic")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Finnish")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Greek")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Polish")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Brazilian")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Egyptian")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Colombian")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Argentinian")>>
	<<if $language is "Spanish">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Turkish")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Iranian")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Armenian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Israeli")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Saudi")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "South African")>>
	<<if $language is "English">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Nigerian")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Congolese")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Kenyan")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Tanzanian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Zimbabwean")>>
	<<if $language is "English" && $activeSlave.race == "white">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Ghanan")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Ugandan")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Ethiopian")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Moroccan")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Chinese")>>
	<<if $language is "Chinese">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Korean")>>
	<<if $language is "Chinese">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Thai")>>
	<<if $language is "Chinese">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Vietnamese")>>
	<<if $language is "Chinese">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Japanese")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Indonesian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Filipina")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Bangladeshi")>>
	<<if $language is "Indian">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Malaysian")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Uzbek")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Afghan")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Nepalese")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Burmese")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Iraqi")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Yemeni")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Sudanese")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Algerian")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Tunisian")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Libyan")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Omani")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Malian")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Jordanian")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Lebanese")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Emirati")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Kazakh")>>
	<<set $activeSlave.accent to $seed>>
<<elseif ($activeSlave.nationality is "Pakistani")>>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to either(0,1,2,3)>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Indian")>>
	<<if $language is "Indian">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "Australian")>>
	<<if $language is "English">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif ($activeSlave.nationality is "a New Zealander")>>
	<<if $language is "English">>
	<<set $activeSlave.accent to 1>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif $activeSlave.nationality is "Roman Revivalist">>
	<<if $language is "Latin">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif $activeSlave.nationality is "Ancient Egyptian Revivalist">>
	<<if $language is "Ancient Egyptian">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif $activeSlave.nationality is "Edo Revivalist">>
	<<if $language is "Japanese">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif $activeSlave.nationality is "Arabian Revivalist">>
	<<if $language is "Arabic">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<elseif $activeSlave.nationality is "Ancient Chinese Revivalist">>
	<<if $language is "Chinese">>
	<<set $activeSlave.accent to 0>>
	<<else>>
	<<set $activeSlave.accent to $seed>>
	<</if>>
<<else>>
	<<set $activeSlave.accent to $seed>>
<</if>>

<<if $activeSlave.nationality is $language>>
	<<set $activeSlave.accent to 0>>
<</if>>

<</widget>>

path: devNotes/Slave Generation Widgets.txt


code:
########################################################################################################################
#
# sugarcube-2.py
#
# Copyright (c) 2013-2017 Thomas Michael Edwards <tmedwards@motoslave.net>. All rights reserved.
# Use of this source code is governed by a Simplified BSD License which can be found in the LICENSE file.
#
########################################################################################################################

import os, os.path, header
from collections import OrderedDict

class Header (header.Header):

	def filesToEmbed(self):
		userLibPath = self.path + os.sep + 'userlib.js'
		if os.path.isfile(userLibPath):
			return OrderedDict([
				('"USER_LIB"', userLibPath)
			])
		else:
			return OrderedDict()

	def storySettings(self):
		return "SugarCube 2.x does not support the StorySettings special passage.\n\nInstead, you should use its configuration object, config.\n    See: http://www.motoslave.net/sugarcube/2/docs/config-object.html"

	def isEndTag(self, name, tag):
		return (name == ('/' + tag) or name == ('end' + tag))

	def nestedMacros(self):
		return [
				# standard macros
				'append',
				'button',
				'capture',
				'createplaylist',
				'for',
				'if',
				'link',
				'linkappend',
				'linkprepend',
				'linkreplace',
				'nobr',
				'prepend',
				'repeat',
				'replace',
				'script',
				'switch',
				'silently',
				'timed',
				'widget',
				# deprecated macros
				'click'
			]

	def passageTitleColor(self, passage):
		additionalSpecialPassages = [
				'PassageDone',
				'PassageFooter',
				'PassageHeader',
				'PassageReady',
				'StoryBanner',
				'StoryCaption',
				'StoryShare'
			]
		if passage.isStylesheet():
			return ((111, 49, 83), (234, 123, 184))
		elif passage.isScript():
			return ((89, 66, 28), (226, 170, 80))
		elif ('widget' in passage.tags):
			return ((80, 106, 26), (134, 178, 44))
		elif passage.isInfoPassage() or (passage.title in additionalSpecialPassages):
			return ((28, 89, 74), (41, 214, 113))
		elif passage.title == 'Start':
			return ('#4ca333', '#4bdb24')

	def passageChecks(self):
		return super(Header, self).passageChecks()


code:
How to mod (basic doc):

1. All sources now in the src subdir, in separate files. 1 passage = 1 file.

2. Special files and dir's:
    - src/config 		- configuration of the story is here.
    - src/config/start.tw 	- contains list of .tw passage files, regenerated automatic, by building scripts. Do not change by hands. (origial passage Start from pregmod renamed and moved to src/events/intro/introSummary.tw)
    - src/js/storyJS.tw		- special passage with [script] tag - contain all native JavaScript from pregmod.
    - devTools/tweeGo/targets/sugarcube-2/userlib.js - on original FC JS moved here (I deleted it after moving JS to storyJS.tw). Compare to storyJS.tw but do not copy file here. May conflict with src/js/storyJS.tw if copied.
    - src/pregmod 		- I put all pregmod-only passages here.
    - .gitignore 		- special file for git - to ignore some files. For example - compilation results.

3. Compilation:

    Windows:
    Run compile.bat - result will be file bin/FC_pregmod.html
    Second run of compile.but will overwrite bin/FC_pregmod.html without prompt.

    Linux:
    Ensure executable permission on file "devTools/tweeGo/tweego" (not tweego.exe!)
    Ensure executable permission on file "compile"
    In the root dir of sources (where you see src, devTools, bin...) run command "./compile" from console
    compile-git will produce the same result file but with current commit hash in filename.

    Mac:
    Don't supported directly (I don't have access to Mac for testing).
    But potentially can be used linux compilation script if you download tweego for mac from here: https://bitbucket.org/tmedwards/tweego/downloads/ and replace linux executable with mac executable in ./devTools/tweeGo/ folder. This is not tested though.

4. Simple comparing and merging with original FC:

    Use meld tool. Place folder FreeCities (original FC sources tree) near FreeCitiesPregmod (this sources tree) and use command:
    meld FreeCities FreeCitiesPregmod
    or just select these folders in meld's GUI.

5. All modders will be wery grateful if any, who make some changes to game, with .html file also post his/her resulting src folder tree.

6. For contributors to pregmod: if you don't use git, then you need to post yours version of src folder tree, not just produced FC_pregmod.html file!!! This html file can't be reverted to proper sources, and useless as contribution!

7. Git workflow:
    - Master branch is pregmod-master. Only Pregmodder can add something to it directly. Always contain his last public changes.
    - pregmod-dev - branch with experimental code mainly by pregmodfan.
    - Any contributions will be placed in separate branches like pregmod-mod-<something> (if it's ready to merge with master complete feature/mod) or pregmod-contrib-<something> if it's partial work until contributions is reviewed.

    Typical cycle with git:
	1. Make account on gitgud if you don't have usable one.
	2. Fork main repository through gitgud interface. (Or pull changes from main repo if you already have fork.)
	3. Clone your fork to local machine witn git client  (Or pull changes if already cloned.)
	4. Make you changes as you like, commit, and push result into your forked repository (with git client).
	5. Make merge request through gitgud interface.


code:
:: MOD_Edit Arcology Cheat [nobr]

	<<set $nextButton = "Continue">>
	<<set $nextLink = "MOD_Edit Arcology Cheat Datatype Cleanup">>
	<<set $PC.actualAge = Math.clamp($PC.actualAge, 14, 80)>>

''Cheating Edit Arcology''

<<if ($economy != 1) || ($seeDicks != 25) || ($continent != "North America") || ($internationalTrade != 1) || ($internationalVariety != 1) || ($seeRace != 1) || ($seeNationality != 1) || ($seeExtreme != 0) || ($plot != 1)>>
	//[[restore defaults|MOD_Edit Arcology Cheat][$seeDicks = 25,$economy = 1,$continent = "North America",$internationalTrade = 1,$internationalVariety = 1,$seeRace = 1,$seeNationality = 1,$seeExtreme = 0,$plot = 1]]//
<</if>>

<<if $economy == 1>>
	The world economy is in ''doubtful'' shape.
	[[Easier|MOD_Edit Arcology Cheat][$economy = 0.5]] | [[Harder|MOD_Edit Arcology Cheat][$economy = 1.5]]
<<elseif $economy < 1>>
	The world economy is still in ''good'' shape.
	[[Harder|MOD_Edit Arcology Cheat][$economy = 1]]
<<else>>
	The world economy is in ''terrible'' shape.
	[[Easier|MOD_Edit Arcology Cheat][$economy = 1]]
<</if>>

<<set $drugsCost = Math.trunc(100*$economy)>>
<<set $rulesCost = Math.trunc(100*$economy)>>
<<set $modCost = Math.trunc(50*$economy)>>
<<set $surgeryCost = Math.trunc(300*$economy)>>

The arcology is located in ''$continent''.

[[North America|MOD_Edit Arcology Cheat][$continent = "North America", $language = "English"]] | [[South America|MOD_Edit Arcology Cheat][$continent = "South America", $language = "Spanish"]] | [[Europe|MOD_Edit Arcology Cheat][$continent = "Europe", $language = "English"]] | [[the Middle East|MOD_Edit Arcology Cheat][$continent = "the Middle East", $language = "Arabic"]] | [[Africa|MOD_Edit Arcology Cheat][$continent = "Africa", $language = "Arabic"]] | [[Asia|MOD_Edit Arcology Cheat][$continent = "Asia", $language = "Chinese"]] | [[Australia|MOD_Edit Arcology Cheat][$continent = "Australia", $language = "English"]] | [[Japan|MOD_Edit Arcology Cheat][$continent = "Japan", $language = "Japanese"]]

The lingua franca of the arcology is ''$language''.

<<if $language != "English">>
	[[English|MOD_Edit Arcology Cheat][$language = "English"]] |
<<else>>
	English |
<</if>>
<<if $language != "Spanish">>
	[[Spanish|MOD_Edit Arcology Cheat][$language = "Spanish"]] |
<<else>>
	Spanish |
<</if>>
<<if $language != "Arabic">>
	[[Arabic|MOD_Edit Arcology Cheat][$language = "Arabic"]] |
<<else>>
	Arabic |
<</if>>
<<if $language != "Chinese">>
	[[Chinese|MOD_Edit Arcology Cheat][$language = "Chinese"]] |
<<else>>
	Chinese |
<</if>>
Custom: <<textbox "$language" $language "MOD_Edit Arcology Cheat">>

<<if $internationalTrade == 0>>
	The slave trade is ''continental,'' so a narrower variety of slaves will be available.
	[[Allow intercontinental trade|MOD_Edit Arcology Cheat][$internationalTrade = 1]]
<<else>>
	The slave trade is ''international,'' so a wider variety of slaves will be available.
	[[Restrict the trade to continental|MOD_Edit Arcology Cheat][$internationalTrade = 0]]
<</if>>

<<if $internationalTrade == 1>>
<<if $internationalVariety == 0>>
	International slave variety is ''semi-realistic,'' so more populous nations will be more common.
	[[Normalized national variety|MOD_Edit Arcology Cheat][$internationalVariety = 1]]
<<else>>
	International slave variety is ''normalized,'' so small nations will appear nearly as much as large ones.
	[[Semi-realistic national variety|MOD_Edit Arcology Cheat][$internationalVariety = 0]]
<</if>>
<</if>>

<<if $seeRace == 1>>
	Ethnicity will ''occasionally'' be mentioned.
	[[Disable most mentions of race|MOD_Edit Arcology Cheat][$seeRace = 0]]
<<else>>
	Ethnicity will ''almost never'' be mentioned.
	[[Enable mentions of race|MOD_Edit Arcology Cheat][$seeRace = 1]]
<</if>>

<<if $seeNationality == 1>>
	Nationality will ''occasionally'' be mentioned.
	[[Disable most mentions of nationality|MOD_Edit Arcology Cheat][$seeNationality = 0]]
<<else>>
	Nationality will ''almost never'' be mentioned.
	[[Enable mentions of nationality|MOD_Edit Arcology Cheat][$seeNationality = 1]]
<</if>>

<<if $seeExtreme == 1>>
	Extreme content like amputation is ''enabled''.
	[[Disable|MOD_Edit Arcology Cheat][$seeExtreme = 0]]
<<else>>
	Extreme content like amputation is ''disabled''.
	[[Enable|MOD_Edit Arcology Cheat][$seeExtreme = 1]]
<</if>>

<<if ($weightAffectsAssets != 0)>>
Slave assets affected by weight is ''enabled''. [[Disable|MOD_Edit Arcology Cheat][$weightAffectsAssets = 0]]
<<else>>
Slave assets affected by weight is ''disabled''. [[Enable|MOD_Edit Arcology Cheat][$weightAffectsAssets = 1]]
<</if>> //If enabled, thin slaves will have large assets drop in size and vice versa at week end. (Diet still affects asset sizes).//

<<if ($curativeSideEffects != 0)>>
Curative side effects are ''enabled''. [[Disable|MOD_Edit Arcology Cheat][$curativeSideEffects = 0]]
<<else>>
Curative side effects are ''disabled''. [[Enable|MOD_Edit Arcology Cheat][$curativeSideEffects = 1]]
<</if>> //If enabled, curatives have a chance to give slaves harmful side effects.//

Slave girls will
<<if $seeDicks >= 90>>
	''almost always'' have dicks.
	[[No chicks with dicks pls (0%)|MOD_Edit Arcology Cheat][$seeDicks = 0]]
	 | [[Side order of girl dick (25%)|MOD_Edit Arcology Cheat][$seeDicks = 25]]
	 | [[Balanced dick chick diet (50%)|MOD_Edit Arcology Cheat][$seeDicks = 50]]
	 | [[Dickgirl main course (75%)|MOD_Edit Arcology Cheat][$seeDicks = 75]]
<<elseif $seeDicks > 50>>
	''more likely than not'' have dicks.
	[[No chicks with dicks pls (0%)|MOD_Edit Arcology Cheat][$seeDicks = 0]]
	 | [[Side order of girl dick (25%)|MOD_Edit Arcology Cheat][$seeDicks = 25]]
	 | [[Balanced dick chick diet (50%)|MOD_Edit Arcology Cheat][$seeDicks = 50]]
	 | [[All of the dicks (100%)|MOD_Edit Arcology Cheat][$seeDicks = 100]]
<<elseif $seeDicks > 25>>
	''occasionally'' have dicks.
	[[No chicks with dicks pls (0%)|MOD_Edit Arcology Cheat][$seeDicks = 0]]
	 | [[Side order of girl dick (25%)|MOD_Edit Arcology Cheat][$seeDicks = 25]]
	 | [[Dickgirl main course (75%)|MOD_Edit Arcology Cheat][$seeDicks = 75]]
	 | [[All of the dicks (100%)|MOD_Edit Arcology Cheat][$seeDicks = 100]]
<<elseif $seeDicks > 0>>
	''rarely'' have dicks.
	[[No chicks with dicks pls (0%)|MOD_Edit Arcology Cheat][$seeDicks = 0]]
	 | [[Balanced dick chick diet (50%)|MOD_Edit Arcology Cheat][$seeDicks = 50]]
	 | [[Dickgirl main course (75%)|MOD_Edit Arcology Cheat][$seeDicks = 75]]
	 | [[All of the dicks (100%)|MOD_Edit Arcology Cheat][$seeDicks = 100]]
<<else>>
	''almost never'' have dicks.
	 [[Side order of girl dick (25%)|MOD_Edit Arcology Cheat][$seeDicks = 25]]
	 | [[Balanced dick chick diet (50%)|MOD_Edit Arcology Cheat][$seeDicks = 50]]
	 | [[Dickgirl main course (75%)|MOD_Edit Arcology Cheat][$seeDicks = 75]]
	 | [[All of the dicks (100%)|MOD_Edit Arcology Cheat][$seeDicks = 100]]
<</if>>
<<link "Go your own dick way">>
	<<textbox "$seeDicks" $seeDicks>>
	[[Apply|MOD_Edit Arcology Cheat][$seeDicks = Number($seeDicks)]]
<</link>>

<<if $plot == 1>>
	Game mode: ''two-handed''. Includes non-erotic events concerning the changing world.
	[[Disable non-erotic events|MOD_Edit Arcology Cheat][$plot = 0]]
<<else>>
	Game mode: ''one-handed''. No non-erotic events concerning the changing world.
	[[Enable non-erotic events|MOD_Edit Arcology Cheat][$plot = 1]]
<</if>>

/*<<nobr>>
<<if $normalizedEvents == 1>>
	Random events distribution: ''normalized''. Random events will happen with equal frequency.
	[[Realistic|MOD_Edit Arcology Cheat][$normalizedEvents = 0]]
<<else>>
	Random events distribution: ''realistic''. Events will happen more frequently if more slaves qualify for them.
	[[Normalize|MOD_Edit Arcology Cheat][$normalizedEvents = 1]]
<</if>>
<</nobr>>*/

__Player Character__

<<if $PC.title > 0>>
	Conversational title: ''Master''.
	[[Switch to Mistress|MOD_Edit Arcology Cheat][$PC.title = 0]]
<<else>>
	Conversational title: ''Mistress''.
	[[Switch to Master|MOD_Edit Arcology Cheat][$PC.title = 1]]
<</if>>

	Career: ''$PC.career''.
	[[Wealth|MOD_Edit Arcology Cheat][$PC.career = "wealth"]] |
	[[Business|MOD_Edit Arcology Cheat][$PC.career = "capitalist"]] |
	[[PMC work|MOD_Edit Arcology Cheat][$PC.career = "mercenary"]] |
	[[Slaving|MOD_Edit Arcology Cheat][$PC.career = "slaver"]] |
	[[Engineering|MOD_Edit Arcology Cheat][$PC.career = "engineer"]] |
	[[Medicine|MOD_Edit Arcology Cheat][$PC.career = "medicine"]] |
	[[Celebrity|MOD_Edit Arcology Cheat][$PC.career = "celebrity"]]

	Method of acquiring the arcology: ''$PC.rumor''.
	[[Wealth|MOD_Edit Arcology Cheat][$PC.rumor = "wealth"]] |
	[[Hard work|MOD_Edit Arcology Cheat][$PC.rumor = "diligence"]] |
	[[Force|MOD_Edit Arcology Cheat][$PC.rumor = "force"]] |
	[[Social engineering|MOD_Edit Arcology Cheat][$PC.rumor = "social engineering"]] |
	[[Luck|MOD_Edit Arcology Cheat][$PC.rumor = "luck"]]

<<if $PC.dick > 0>>
	Genitalia: ''penis''. Standard sex scenes; easier reputation maintenance.
	[[Switch to vagina|MOD_Edit Arcology Cheat][$PC.dick = 0]]
<<else>>
	Genitalia: ''vagina''. Sex scene variations; more difficult reputation maintenance.
	[[Switch to penis|MOD_Edit Arcology Cheat][$PC.dick = 1]]
<</if>>

<<if $PC.boobs > 0>>
	Chest: ''breasts''. Sex scene variations; more difficult reputation maintenance.
	[[Remove breasts|MOD_Edit Arcology Cheat][$PC.boobs = 0]]
<<else>>
	Chest: ''masculine''. Standard sex scenes; easier reputation maintenance.
	[[Add breasts|MOD_Edit Arcology Cheat][$PC.boobs = 1]]
<</if>>

Age:
<<if $PC.actualAge >= 65>>
	''old''.
<<elseif $PC.actualAge >= 50>>
	''well into middle age''.
<<elseif $PC.actualAge >= 35>>
	''entering middle age''.
<<else>>
	''surprisingly young''.
<</if>>
<<textbox "$PC.actualAge" $PC.actualAge "MOD_Edit Arcology Cheat">>
<<set $PC.physicalAge = $PC.actualAge, $PC.visualAge = $PC.actualAge>>

<<if $playerAging == 2>>
	You will ''age naturally.''
	[[Disable aging|MOD_Edit Arcology Cheat][$playerAging = 0]] |
	[[Semi aging|MOD_Edit Arcology Cheat][$playerAging = 1]]
<<elseif $playerAging == 1>>
	You ''will'' celebrate birthdays, but ''not age.''
	[[Enable aging fully|MOD_Edit Arcology Cheat][$playerAging = 2]] |
	[[Disable aging|MOD_Edit Arcology Cheat][$playerAging = 0]]
<<else>>
	You will ''not age,'' and not experience birthdays.
	[[Enable aging|MOD_Edit Arcology Cheat][$playerAging = 2]] |
	[[Semi aging|MOD_Edit Arcology Cheat][$playerAging = 1]]
<</if>>
//This option cannot be changed during the game//

Rename your character: <<textbox "$PCName" $PCName "MOD_Edit Arcology Cheat">>

Nationality: ''$PC.nationality''.<<textbox "$PC.nationality" $PC.nationality "MOD_Edit Arcology Cheat">>

Race: ''$PC.race''.
	[[White|MOD_Edit Arcology Cheat][$PC.race = "white"]] |
	[[Asian|MOD_Edit Arcology Cheat][$PC.race = "asian"]] |
	[[Latina|MOD_Edit Arcology Cheat][$PC.race = "latina"]] |
	[[Middle Eastern|MOD_Edit Arcology Cheat][$PC.race = "middle eastern"]] |
	[[Black|MOD_Edit Arcology Cheat][$PC.race = "black"]] |
	[[Semitic|MOD_Edit Arcology Cheat][$PC.race = "semitic"]] |
	[[Southern European|MOD_Edit Arcology Cheat][$PC.race = "southern european"]] |
	[[Indo-aryan|MOD_Edit Arcology Cheat][$PC.race = "indo-aryan"]] |
	[[Amerindian|MOD_Edit Arcology Cheat][$PC.race = "amerindien"]] |
	[[Pacific Islander|MOD_Edit Arcology Cheat][$PC.race = "pacific islander"]] |
	[[Malay|MOD_Edit Arcology Cheat][$PC.race = "malay"]] |
	[[Mixed Race|MOD_Edit Arcology Cheat][$PC.race = "mixed race"]]

Skin: ''$PC.skin''.
	[[White|MOD_Edit Arcology Cheat][$PC.skin = "white"]] |
	[[Fair|MOD_Edit Arcology Cheat][$PC.skin = "fair"]] |
	[[Light|MOD_Edit Arcology Cheat][$PC.skin = "light"]] |
	[[Dark|MOD_Edit Arcology Cheat][$PC.skin = "dark"]] |
	[[Olive|MOD_Edit Arcology Cheat][$PC.skin = "olive"]] |
	[[Black|MOD_Edit Arcology Cheat][$PC.skin = "black"]] |
	[[Light Brown|MOD_Edit Arcology Cheat][$PC.skin = "light brown"]] |
	[[Brown|MOD_Edit Arcology Cheat][$PC.skin = "brown"]] |
	[[Pale|MOD_Edit Arcology Cheat][$PC.skin = "pale"]] |
	[[Extremely Pale|MOD_Edit Arcology Cheat][$PC.skin = "extremely pale"]]

Eye color: ''$PC.eyeColor''.
<<textbox "$PC.eyeColor" $PC.eyeColor "MOD_Edit Arcology Cheat">>

Hair color: ''$PC.hColor''.
<<textbox "$PC.hColor" $PC.hColor "MOD_Edit Arcology Cheat">>

Preferred refreshment: <<textbox "$PC.refreshment" $PC.refreshment "MOD_Edit Arcology Cheat">> [[Cigars|MOD_Edit Arcology Cheat][$PC.refreshment = "cigar",$PC.refreshmentType = 0]] | [[Whiskey|MOD_Edit Arcology Cheat][$PC.refreshment = "whiskey",$PC.refreshmentType = 1]]

Preferred method of consumption: <<if $PC.refreshmentType == 0>>Smoked<<elseif $PC.refreshmentType == 1>>Drank<<elseif $PC.refreshmentType == 2>>Eaten<<elseif $PC.refreshmentType == 3>>Snorted<<else>>Injected<</if>>

[[Smoked|MOD_Edit Arcology Cheat][$PC.refreshmentType = 0]] | [[Drank|MOD_Edit Arcology Cheat][$PC.refreshmentType = 1]] | [[Eaten|MOD_Edit Arcology Cheat][$PC.refreshmentType = 2]] | [[Snorted|MOD_Edit Arcology Cheat][$PC.refreshmentType = 3]] | [[Injected|MOD_Edit Arcology Cheat][$PC.refreshmentType = 4]]

Arcology citizens: $ACitizens
<<textbox "$ACitizens" $ACitizens>>

Arcology sex slaves: $ASlaves
<<textbox "$ASlaves" $ASlaves>>

Arcology menial slaves:  $AHelots
<<textbox "$AHelots" $AHelots>>

Arcology prosperity cap: $AProsperityCap
<<textbox "$AProsperityCap" $AProsperityCap>>

Shelter Abuse Counter: $shelterAbuse
<<textbox "$shelterAbuse" $shelterAbuse>>

''The Slavegirl School:''

TSS Students Bought: <<textbox "$TSS.studentsBought" $TSS.studentsBought>>

TSS Upgrades: ''$TSS.schoolUpgrade'' |
<<radiobutton "$TSS.schoolUpgrade" 0>> 0
| <<radiobutton "$TSS.schoolUpgrade" 1>> 1
| <<radiobutton "$TSS.schoolUpgrade" 2>> 2

TSS Moved to Arcology: ''$TSS.schoolPresent'' |
<<radiobutton "$TSS.schoolPresent" 0>> 0
| <<radiobutton "$TSS.schoolPresent" 1>> 1 (Moved)

TSS Prosperity: <<textbox "$TSS.schoolProsperity" $TSS.schoolProsperity>>

TSS Failed: ''$TSS.schoolAnnexed'' |
<<radiobutton "$TSS.schoolAnnexed" 0>> 0
| <<radiobutton "$TSS.schoolAnnexed" 1>> 1 (Failed)

''The Growth Research Institute:''

GRI Students Bought: <<textbox "$GRI.studentsBought" $GRI.studentsBought>>

GRI Upgrades: ''$GRI.schoolUpgrade'' |
<<radiobutton "$GRI.schoolUpgrade" 0>> 0
| <<radiobutton "$GRI.schoolUpgrade" 1>> 1
| <<radiobutton "$GRI.schoolUpgrade" 2>> 2

GRI Moved to Arcology: ''$GRI.schoolPresent'' |
<<radiobutton "$GRI.schoolPresent" 0>> 0
| <<radiobutton "$GRI.schoolPresent" 1>> 1 (Moved)

GRI Prosperity: <<textbox "$GRI.schoolProsperity" $GRI.schoolProsperity>>

GRI Failed: ''$GRI.schoolAnnexed'' |
<<radiobutton "$GRI.schoolAnnexed" 0>> 0
| <<radiobutton "$GRI.schoolAnnexed" 1>> 1 (Failed)

''St. Claver Preparatory:''

SCP Students Bought: <<textbox "$SCP.studentsBought" $SCP.studentsBought>>

SCP Upgrades: ''$SCP.schoolUpgrade'' |
<<radiobutton "$SCP.schoolUpgrade" 0>> 0
| <<radiobutton "$SCP.schoolUpgrade" 1>> 1
| <<radiobutton "$SCP.schoolUpgrade" 2>> 2

SCP Moved to Arcology: ''$SCP.schoolPresent'' |
<<radiobutton "$SCP.schoolPresent" 0>> 0
| <<radiobutton "$SCP.schoolPresent" 1>> 1 (Moved)

SCP Prosperity: <<textbox "$SCP.schoolProsperity" $SCP.schoolProsperity>>

SCP Failed: ''$SCP.schoolAnnexed'' |
<<radiobutton "$SCP.schoolAnnexed" 0>> 0
| <<radiobutton "$SCP.schoolAnnexed" 1>> 1 (Failed)

<<if ($seeDicks != 0)>>

''L'Ecole des Enculees:''

LDE Students Bought: <<textbox "$LDE.studentsBought" $LDE.studentsBought>>

LDE Upgrades: ''$LDE.schoolUpgrade'' |
<<radiobutton "$LDE.schoolUpgrade" 0>> 0
| <<radiobutton "$LDE.schoolUpgrade" 1>> 1
| <<radiobutton "$LDE.schoolUpgrade" 2>> 2

LDE Moved to Arcology: ''$LDE.schoolPresent'' |
<<radiobutton "$LDE.schoolPresent" 0>> 0
| <<radiobutton "$LDE.schoolPresent" 1>> 1 (Moved)

LDE Prosperity: <<textbox "$LDE.schoolProsperity" $LDE.schoolProsperity>>

LDE Failed: ''$LDE.schoolAnnexed'' |
<<radiobutton "$LDE.schoolAnnexed" 0>> 0
| <<radiobutton "$LDE.schoolAnnexed" 1>> 1 (Failed)

	''The Gymnasium-Academy:''

TGA Students Bought: <<textbox "$TGA.studentsBought" $TGA.studentsBought>>

TGA Upgrades: ''$TGA.schoolUpgrade''
<<radiobutton "$TGA.schoolUpgrade" 0>> 0
| <<radiobutton "$TGA.schoolUpgrade" 1>> 1
| <<radiobutton "$TGA.schoolUpgrade" 2>> 2

TGA Moved to Arcology: ''$TGA.schoolPresent'' |
<<radiobutton "$TGA.schoolPresent" 0>> 0
| <<radiobutton "$TGA.schoolPresent" 1>> 1 (Moved)

TGA Prosperity: <<textbox "$TGA.schoolProsperity" $TGA.schoolProsperity>>

TGA Failed: ''$TGA.schoolAnnexed'' |
<<radiobutton "$TGA.schoolAnnexed" 0>> 0
| <<radiobutton "$TGA.schoolAnnexed" 1>> 1 (Failed)

	''The Futanari Sisters:''

TFS Students Bought: <<textbox "$TFS.studentsBought" $TFS.studentsBought>>

TFS Upgrades: ''$TFS.schoolUpgrade'' |
<<radiobutton "$TFS.schoolUpgrade" 0>> 0
| <<radiobutton "$TFS.schoolUpgrade" 1>> 1
| <<radiobutton "$TFS.schoolUpgrade" 2>> 2

TFS Moved to Arcology: ''$TFS.schoolPresent'' |
<<radiobutton "$TFS.schoolPresent" 0>> 0
| <<radiobutton "$TFS.schoolPresent" 1>> 1 (Moved)

TFS Prosperity:<<textbox "$TFS.schoolProsperity" $TFS.schoolProsperity>>

TFS Failed: ''$TFS.schoolAnnexed'' |
<<radiobutton "$TFS.schoolAnnexed" 0>> 0
| <<radiobutton "$TFS.schoolAnnexed" 1>> 1 (Failed)
<</if>>

__Arcologies:__

    __''$arcologies[0].name''__ is your arcology.

You own: ''$arcologies[0].ownership%'' of the arcology <<textbox "$arcologies[0].ownership" $arcologies[0].ownership>>

Other minority ownership: ''$arcologies[0].minority%'' <<textbox "$arcologies[0].minority" $arcologies[0].minority>>

$arcologies[0].name's GSP is
@@color:yellowgreen;¤<<print Math.trunc(0.1*$arcologies[0].prosperity)>>m@@.

<<if $arcologies.length > 1>>
<<set _neighbors = Number($arcologies.length-1)>>

Your arcology has <<print Number($arcologies.length-1)>>
<<if _neighbors == 1>> neighbor<<else>> neighbors<</if>>.
<<else>>
Your arcology has no neighbors.
<</if>>

<<if $arcologies.length < 8>>
<<link "Add neighbor">>
	<<set $seed = ["north", "northeast", "east", "southeast", "south", "southwest", "west", "northwest"]>>

	<<set $activeArcology = {name: "Arcology X-", direction: "north", government: "an individual", honeymoon: 0, prosperity: 50, ownership: 50, minority: 20, PCminority: 0, demandFactor:0, FSSupremacist: "unset", FSSupremacistRace: 0, FSSubjugationist: "unset", FSSubjugationistRace: 0, FSGenderRadicalist: "unset", FSGenderFundamentalist: "unset", FSPaternalist: "unset", FSDegradationist: "unset", FSBodyPurist: "unset", FSTransformationFetishist: "unset", FSYouthPreferentialist: "unset", FSMaturityPreferentialist: "unset", FSSlimnessEnthusiast: "unset", FSAssetExpansionist: "unset", FSPastoralist: "unset", FSPhysicalIdealist: "unset", FSChattelReligionist: "unset", FSRomanRevivalist: "unset", FSEgyptianRevivalist: "unset", FSEdoRevivalist: "unset", FSArabianRevivalist: "unset", FSChineseRevivalist: "unset", FSNull: "unset", embargo: 1, embargoTarget: -1, influenceTarget: -1, influenceBonus: 0, rival: 0}>>

	<<if $arcologies.length < 4>>
		<<set $activeArcology.name = $activeArcology.name+$arcologies.length>>
	<<else>>
		<<set $activeArcology.name = $activeArcology.name+($arcologies.length+1)>>
	<</if>>

	<<set $activeArcology.direction = $seed.pluck()>>
	<<set $activeArcology.government = random(0,5)>>
	<<set $activeArcology.prosperity += random(-20,20)>>
	<<set $activeArcology.ownership += random(-10,0)>>
	<<set $activeArcology.minority += random(-5,5)>>
	<<set $arcologies.push($activeArcology)>>

	<<goto "MOD_Edit Arcology Cheat">>
<</link>>
<</if>>

<<set $averageProsperity = 0>>
<<set $seed = 0>>
<<for $i = 0; $i lt $arcologies.length; $i++>>
	<<set $averageProsperity += $arcologies[$i].prosperity>>
	<<set $seed += 1>>
<</for>>
<<set $averageProsperity = $averageProsperity/$seed>>

<<for $i = 0; $i < $arcologies.length; $i++>>
	<<if $arcologies[$i].direction != 0>>
	<<display "Neighbor Description">>
	<</if>>

	<<if $i != 0>>
	<<print "[[Remove neighbor|MOD_Edit Arcology Cheat][$arcologies.pluck( [" + $i + "], [" + $i + "] )]]">>
	<</if>>
<</for>>


code:
:: MOD_Edit Arcology Cheat Datatype Cleanup

<<nobr>>
	<<set $nextButton = "Continue">>
	<<set $nextLink = "Manage Arcology">>

	<<set $ACitizens = Number($ACitizens)>>
	<<set $ASlaves = Number($ASlaves)>>
	<<set $AHelots = Number($AHelots)>>
	<<set $shelterAbuse = Number($shelterAbuse)>>

	<<set $TSS.studentsBought = Number($TSS.studentsBought)>>
	<<set $TSS.schoolProsperity = Number($TSS.schoolProsperity)>>

	<<set $GRI.studentsBought = Number($GRI.studentsBought)>>
	<<set $GRI.schoolProsperity = Number($GRI.schoolProsperity)>>

	<<set $SCP.studentsBought = Number($SCP.studentsBought)>>
	<<set $SCP.schoolProsperity = Number($SCP.schoolProsperity)>>

	<<set $LDE.studentsBought = Number($LDE.studentsBought)>>
	<<set $LDE.schoolProsperity = Number($LDE.schoolProsperity)>>

	<<set $TGA.studentsBought = Number($TGA.studentsBought)>>
	<<set $TGA.schoolProsperity = Number($TGA.schoolProsperity)>>

	<<set $TFS.studentsBought = Number($TFS.studentsBought)>>
	<<set $TFS.schoolProsperity = Number($TFS.schoolProsperity)>>

	<<set $arcologies[0].ownership = Number($arcologies[0].ownership)>>
	<<set $arcologies[0].minority = Number($arcologies[0].minority)>>

	<<set $PC.actualAge = Number($PC.actualAge)>>
	<<set $PC.physicalAge = $PC.actualAge, $PC.visualAge = $PC.actualAge>>

	The chanting grows louder and louder, CHEAT! CHEAT! CHEAT!

	The Arcology morphs and changes shape, CHEAT! CHEAT! CHEAT!

	The Arcology has been changed forever and you forfeit your CHEATING CHEATY SOUL!
<</nobr>>\