Genosupremacy: Religious Competition Simulator
brides

Topics: Master Tribe Theory, Social Antler Theory, human social parasitism, dialectical geneticism

Important

This article assumes that you have already read the Genes & Mating Systems Simulator (GMSS). Failing which, many concepts, such as the elite, polygyny, genetic quality, as well as their applicability to the real world are likely to be misunderstood.

Contact and citation information is included therein.

The following is a computer model for simulating the genetic changes of 19 competing religious tribes over multiple generations, given certain parameters. It is built over an MIT-licensed JavaScript framework to allow other researchers to freely copy, edit, & use. The framework is embedded below the data interpretation, along with an MIT-licensed example of its use immediately after. For those who wish to host this simulator on their own websites, the example is the same code that powers this very simulator and may be copy / pasted to the desired webpage. The simulator also includes a download link.

Lexical clarification: Despotypy refers to a tribe’s propensity for mastery, from the Greek despot- (master) and typ- (model). Conversely, helotypy refers to a tribe’s propensity for subjugation, from the Greek helot- (enslaved). The parameter “order by despotypy” refers to the initial order of execution. By default, the order of execution runs from the weakest to the strongest tribe (and the reason for this is discussed below). However, the initial founding populations are equal in strength and all other measures. As such, the order of execution defaults to coalitional behavior between tribes of a similar type. While the parameter remains enabled, despotypal tribes act in a coalitional manner against helotypal tribes. When it is disabled, the opposite is the case resulting in data akin to an underclass revolt. As such, the states of this parameter correspond to the beginning of a civilizational ascent and descent, respectively.

Moreover, the maximum population parameter is a proxy for the ecological carrying capacity. In most instances, its default value of 100k is too high for it to be a limiting factor in the population growth of any of the tribes. Self-evidently, its effect size is inversely related to its value; in other words: the lower the maximum population, the more of a limiting factor it is.

With regards to diaspora mode, this refers to multiculturalism. By default, it is disabled; in this case, 19 religious tribes compete with one another as states, often militarily. When this parameter is enabled, the same tribes compete with one another within the context of a single state, in a purely non-violent manner. To clarify, the word “competition” is a reference to male-male competition (i.e. sexual competition where females select for the most formidable social antlers) and the word “religion” is used as a catch-all term which encompasses culture, worldview, art, and, most broadly, any product of the mind – the memetic footprint.

The model also accounts for the special case of human social parasitism where a religious tribe engages in exogamous bride gathering, selecting from the genetically highest-quality females of competing tribes, and places their hybrid offspring among the locals of the competing tribe (“infecting the host”), thereby creating a diaspora population of social parasites. From there, the hybrid offspring act as infiltrators who influence and subvert the politics and culture of their host. The quality of non-parasitism is called neutralism, contrasting the social parasite with neutral tribes. Wherever this article mentions that the social parasite achieves genosupremacy over a host, it means that its diaspora population has a higher average GQS than the host population’s average, giving it more sexual access, enhancing its capacity for hypergamy within the host, and ultimately giving it the ability to influence the culture and politics of the host. This is why each tribe has a “decision” attribute; infected hosts may decide to act in a manner contrary to their innate tendencies.

Obligatory reminder: serial monogamy is a form of polygyny which was prevalent before 1930’s, due to maternal mortality; modern humans did not become strictly monogamous until after the 1930’s. Insofar as a genetic cluster’s allele frequency is concerned, the only difference between having multiple brides at the same time vs getting a new bride only once the previous one has died is a delayed bottleneck. This is discussed in greater depth in the GMSS and in the Altruistic Matricide Hypothesis. This notice is added to dispel the defamatory notions of some ignorami that genopolemology promotes polygamy or subverts the institution of marriage; this new scientific field is nothing more than an application of the scientific method to the ubiquitous phenomenon of genetic warfare – an area of science that was unexplored until now, due to the backwards religious zealotry of some commoners (which I do not care if I offend).

Algorithm

Each religious tribe is an instance of the GMSS; its algorithm has been appended to the GMSS article. The tribes each differ in their configurations along the following innate properties:

  • Mating System: possible values are polygyny, monogamy, or polyandry
  • Competition Strategy: possible values are defence, reciprocity, or conquest
  • Ethical System: partialism (cultural self-preference) vs universalism (cultural relativism)

Whether or not a tribe decides to act on their innate properties depends on its internal politics, i.e. the collective decision of its elite. Thus, the general algorithm of the computer model can be summarized as such: for each generation > for each tribe > decide configuration, apply competition strategy, apply migration patterns, calculate statistical data, breed the next generation, and repeat for 9 generations.

Note: the settings below are the parameters by which we define the state of 19 founding populations. The data will be inserted in-between the “Generate Data” button and the data interpretation. Depending on the configuration and the computer’s capability, it can take anywhere between 20 seconds to 2 minutes to generate the data.

Warning: this simulator is very resource-intensive. If you do not have at least 4GB of RAM and a dual core processor, this webpage will likely crash or freeze upon running the simulator. Mobile devices are not recommended.

Interpreting the Data

As with the GMSS,

[…] the model has been thoroughly tested with various settings and it has reliably produced similar values per dataset (given the same settings) – similar but not identical, due to the mutation rate and the pseudo-randomness of gender determination. Whereas the values differ by dataset, the trends observed are identical from one dataset to another (when generated with the same settings).

Genes & Mating Systems Simulator

Ultimately, the actual data is not what we care about for the purposes of this inquiry. Instead, we are concerned with its patterns of change. Here, the simulator is used to control for variables to establish various relationships. E.g. how does one variable affect the system?

Moving forward, an important detail about the social parasite must be mentioned. This tribe represents a non-martial population, like a nomadic orthodox cult or a ghetto of orthodox adherents that keeps to itself rather than a state. As such, it is not subject to military attacks.

Non-Diaspora Mode, Ordered By Despotypy

In the default non-diaspora mode with maximum population left at 100k and the initial order of tribes left from helotypal to despotypal, the tribe “Polygyny, Conquest, Partialist” (PCP) succeeds – almost every time – in subjugating “Polygyny, Reciprocity, Partialist” (PRP) and genociding all other neutral tribes, all within 2 generations. Hence, PCP is referred to as the Master Tribe, having achieved one form of genosupremacy, i.e. a position of genetic supremacy with respect to female sexual preference.

Rarely, the tribe “Monogamy, Conquest, Partialist” (MCP) achieves genosupremacy; this aberration is mediated by the military success of the PCP tribe which is not guaranteed. Thus, MCP demonstrates itself as the fittest tribe in the rare case where PCP fails. In most cases, however, PCP militarily succeeds and demonstrates mercy to PRP by merely subjugating it but stopping short of genocide; this act of clemency is an instance of altruism granted to the tribe that is most like itself culturally and genetically – coalitional behavior.

After 1 generation, the diaspora population of the social parasite succeeds in achieving genosupremacy, but only over its hosts. However, its genosupremacy collapses in the 2nd generation because in non-diaspora mode, it can only infect universalist tribes and those are the tribes which die first. As such, the social parasite defaults to the same behavior as “Polygyny, Defence, Partialist” (PDP) by the 3rd generation.

Summary: in the ascent of civilization, the combination of polygyny, conquest, and partialism is the dominant evolutionary strategy. Any religion or ideology which makes this strategy the will of its god or the natural conclusion of its moral foundation is predicted to achieve genosupremacy. Conversely, universalism is a recessive cultural trait, making social parasitism an unsuccessful evolutionary strategy. In a real world scenario where genocide is unlikely to happen, the social parasite will achieve a very limited success in its evolutionary strategy, due to the continued existence of universalist tribes where defence (the losing strategy) is promoted, according to the model.

Non-Diaspora Mode, Ordered By Helotypy

In the default non-diaspora mode with maximum population left at 100k and the initial order of tribes set from despotypal to helotypal, the Master Tribe is genocided within 1 generation by its despotypal rival MCP. Also within 1 generation, non-conquest partialist tribes permanently establish themselves as the most dominant neutral tribes, lead by PDP. By the 2nd generation, the most despotypal tribes have annihilated themselves; the competition strategy of conquest appears to be highly recessive and is completely wiped out after 6 generations. After 9 generations, PDP remains in 2nd place and is followed by PRP in 3rd.

After 1 generation, the social parasite succeeds in achieving genosupremacy over its hosts. It also becomes the dominant tribe, ahead of PDP. However, this initial dominance is lost in the 2nd generation, as coalitions form. Nevertheless, the social parasite permanently reestablishes total genosupremacy as of generation 9, due to the growth of its universalist hosts’ populations. Furthermore, the social parasite influences its hosts’ politics and culture to be most like PCP (the losing strategy).

Summary: in the descent of civilization, social parasitism is the dominant evolutionary strategy. Among neutral tribes, the most dominant evolutionary strategy is, in a majority of cases, the combination of polygyny, defence, and partialism; less commonly, it is polygyny, reciprocity, and partialism. Conversely, conquest is a recessive cultural trait, making PCP the worst possible combination, given that the Master Tribe is the prime target. The model predicts that a social parasite will promote a religion and politics of conquest (the losing strategy) to universalist tribes.

Diaspora Mode, Ordered By Despotypy

In diaspora mode with maximum population left at 100k and the initial order of tribes left from helotypal to despotypal, PCP establishes genosupremacy after 1 generation. In the 2nd generation, MCP overtakes PCP, due to the consistent success of PCP which invites more counter-attacks from reciprocal tribes. In the 5th generation, “Monogamy, Conquest, Universalist” (MCU) overtakes PCP for 2nd place and this top 3 ranking remains steady in subsequent generations. The tribe “Polyandry, Defence, Universalism” (PDU) is the biggest loser.

However, this ranking is misleading as it implies that MCP has achieved genosupremacy. In diaspora mode, this is inaccurate because within 1 generation, the social parasite had already achieved genosupremacy over every other tribe. Whereas the ghetto that the social parasite represents is never in the top 3 tribes, the top 3 are populated by a diaspora population of the social parasite which has a higher average GQS than its respective host’s average. Thus, many members of their elite are, in fact, infiltrators from the social parasite. The disparity in GQS is lowest in PCP, due to the bottleneck of polygyny.

Summary: in the ascent of civilization, social parasitism is, in a multi-cultural context, covertly the most dominant evolutionary strategy, but the population will perceive MCP, MCU, and PCP as the most dominant tribes, making conquest a highly dominant cultural trait. On the other hand, defence (e.g. anti-hate ideology) is the most recessive cultural trait and the model predicts that the social parasite will promote it.

Diaspora Mode, Ordered By Helotypy

In diaspora mode with maximum population left at 100k and the initial order of tribes set from despotypal to helotypal, conquering and universalist tribes (interchangeably) dominate after 1 generation. In the 2nd generation, MCU takes the top spot. In the 3rd generation, MCP takes 2nd place, followed by the social parasite in 3rd and PCP in 4th. In the 6th generation, PCP overtakes the social parasite and this top 4 ranking remains steady for subsequent generation.

Once again, the social parasite, due to its diaspora populations, remains in a covert position of genosupremacy.

Summary: given the similar results with the previous dataset, the stage of civilization appears to have no significant effect on religious competition in a multicultural context. In both cases, the results are consistent with the theory of dialectical geneticism.

Master Tribe Theory

Master Tribe Theory is an evolutionary theory of despogenesis:

The term “despogenesis” is not a common word in the English language as of my last update in September 2021. However, we can try to deduce its meaning by breaking down its etymological roots:

  1. “despo-” might derive from the Greek word “despotes,” which means “master” or “lord.” This root is seen in words like “despotism,” referring to rule by a single authority, often tyrannical.
  2. “-genesis” is a Greek-derived suffix that means “origin” or “mode of production.” It’s used in many words to indicate the creation or formation of something, as in “biogenesis” or “pathogenesis.”

Piecing these together, “despogenesis” might be interpreted as “the origin of mastery/lordship” or “the creation of a master or lord.” […]

Chat GPT 4

In all cases, polygyny and partialism are strongly selected. In a multicultural environment, conquest is strongly selected, due to the non-lethality of reciprocity. From this, we can deduce that the emergence of a Master Tribe is inevitable from either scenario.

In the ascent of civilization, PCP genes proliferate the most but remain outnumbered by its despotypal coalition. Non-conquest is strongly selected against. Non-polygynous tribes’ commoners expand their genetic distance with their respective elite, resulting in anti-ethnocentric behavior, i.e. populism. Non-partialist tribes also expand their genetic diversity due to immigration, which again results in more populism. As these tribes become more bottom-heavy, their elite clusters expand to include an increasing number of commoners. This results in a growing genetic distance between the new elites and the elite of the Master Tribe, resulting in a growing divergence in genetic interests, which eventually leads to the breakdown of the despotypal coalition, marking the beginning of the civilizational descent.

In the descent of civilization, the despotypal coalition has already broken down and its former member-tribes are now infighting and competing; the Master Tribe is the prime target. Conquest, due to reciprocal tribes, is strongly selected against whereas defence is selected for (given the absence of retaliation). Universalist tribes are now able to survive, leading to the growth of multiculturalism. In turn, multiculturalism selects for conquest (the individual affinity for competition). Over time, polygyny, conquest, and partialism begin to cluster, leading to the eventual emergence of PCP (the Master Tribe). Once the Master Tribe establishes a despotypal coalition, civilizational ascent begins.

Human Social Parasitism (HSP)

In both stages of civilization, the social parasite is nothing more than a compounding factor. This cycle and all problems seen within it would have taken place if the social parasite did not exist. However, the genius of the social parasite goes far beyond merely eugenic exogamy (which is a means and not an end in itself). Instead, it is its propensity to foster genetic dependence which lies at the heart of its success. The social parasite utilizes coevolution – the same mechanism by which farmers affect the evolutionary trajectory of their crop and cattle. By process of domestication, the latter can no longer survive without the farmer and are thus genetically dependent on him. From there, the farmer is able to select who breeds and who doesn’t. Exogamy is simply a prerequisite for achieving this objective.

At every stage of civilization, the social parasite promotes the losing strategy among its host by religious means. When the stage flips, tribes which would have otherwise engaged in a losing strategy now find themselves with a winning strategy. As such, genes which would have otherwise been selected against are now allowed to exist, thanks to the social parasite. Without the religion that was promoted by the social parasite, the host will collapse. This means that the host population is now genetically dependent on the social parasite, thereby conferring upon it the ability to favor what kinds of people breed and those who do not.

In a multicultural context, the promotion of defence (the losing strategy) only exacerbates a pre-existing selective pressure in favor of conquest (the individual affinity for male-male competition). As such, some members of the elite will owe their elite membership (and the evolutionary benefits that come with it) to the social parasite. Again, genes which would not have been able to reproduce themselves are now able to do so, thanks to the social parasite. In turn, it would make evolutionary sense for the social parasite to promote (by cultural means) the breeding of its new genetic dependents.

Thus, it is a misconception to suggest that the social parasite simply wants to watch the host burn. To the contrary, the social parasite cannot implement its evolutionary strategy without a host and, as such, killing the host goes against the social parasite’s evolutionary strategy. What we must remember is that the social parasite must pair the losing strategy with the promise of a new era where, presumably, those who adhere this losing strategy will have “heaven on Earth” when this new era comes. In biological terms, the losing strategy now is the winning strategy in the next stage of civilization (the “new era”).

Given the competition strategy of the social parasite, it has an evolutionary incentive to promote certain ideas among its hosts, such as ideas which welcome the acceleration of the course of civilization and the consumption of the host. One can thus predict some common symbolic elements or themes from religions or ideologies created by the social parasite:

  • Moralizing the consumer (e.g. Semitic fire gods such as Vulcan & Yahweh) and demoralizing the consumed (e.g. Indo-European archetypes, such as the Seraphim)
  • New eras (e.g. Ragnarok, Messianic era, Apocalypse, Qiyamah, Saoshyant)
  • Dying and rising deities (Phoenix, Osiris, Adonis, Jesus, etc.)
  • Cyclical representations of time, e.g. Kronos (time) as the consumer of eras, leading to more “new eras”
  • Expressions such as “rising from the ash” being used in the context of fire gods and new eras
  • “The last shall finish first and the first shall finish last”

Further research is required to determine the mechanism which leads to the emergence of HSP. The mechanism has been discovered, see Human Social Parasitism.

The Framework

Download: Religious Competition Computer Model Framework

/*
Religious Competition Computer Model Framework
Apollonian Regime (c) 2023
https://apollonianregime.com/wp-content/genosupremacy.js
License: MIT
Extends:
Mating Systems Computer Model Framework V2
Apollonian Regime (c) 2023
https://apollonianregime.com/wp-content/mating-systems-V2.js
License: MIT
Host URL: https://apollonianregime.com/genes-mating-systems-simulator
Host Page: Genes & Mating Systems Simulator (GMSS)
*/
function religiousCompetition(func)
{
	// fixed: 9 gens + 50% tax + default parameters of GMSS
	var gens = [ Tribe.setTribes() ];
    for( let i = 1; i < 10; i++ )
    {
        gens.push(Tribe.progress(i));
    }
	return gens;
}
function Tribe(data)
{
	for(var key in data)
	{
		this[key] = data[key];
	}
    this.idx = 0;
	this.children = 4;
	this.eliteGQS = 2;
	this.commonerGQS = 1;
	this.eliteMaleBudget = 1000000;
	this.commonerMaleBudget = 100000;
	this.costPerChild = 50000;
	this.multiplier = 1;
	this.conquered = [];
	for(var key in data)
	{
		this[key] = data[key];
	}
	this.state = this.state || 'Tribe('.concat(
			this.systemName(), ', ', 
			this.strategyName(), ', ',
			this.ethicsName(), ')' );
    var gen = Generation.first(this);
	for(var key in data)
	{
		gen[key] = data[key];
	}
	gen.decision = this.systemName().concat(
		', ', this.strategyName(), 
        ', ', this.ethicsName()
    );
    this.data = [ gen ];
}
Tribe.maxPop = 100000;
Tribe.orderByDespotypy = true;
Tribe.diaspora = false;
Tribe.populate = function()
{
	SocialParasite.infiltrators.push([]);
	Tribe.tribes.forEach((tribe)=>{
		tribe.reproduce();
	});
	Tribe.sort();
};
Tribe.sort = function()
{
	Tribe.tribes.sort(Tribe.strengthDiff);
};
Tribe.next = {
	true: Tribe.populate,
	false: Tribe.sort
};
Tribe.govern = function(i)
{
	Tribe.tribes.forEach((tribe)=>{
		tribe.vote();
	});
	Tribe.tribes.forEach((tribe)=>{
		tribe.act();
	});
	Tribe.tribes.forEach((tribe)=>{
		tribe.migrate();
	});
};
Tribe.progress = function(i)
{
	Tribe.govern();
	var stats = [];
	Tribe.tribes.forEach((tribe)=>{
		stats.push( tribe.gen().statistics() );
	});
	Tribe.next[i < 10]();
	return stats;
};
Tribe.fromLast = function(offset)
{
	return Tribe.tribes[Tribe.tribes.length - offset];
};
Tribe.strongestUniversalist = function()
{
	var offset = 1;
	while(Tribe.fromLast(offset).partialist)
	{
		offset++;
		if(offset === Tribe.tribes.length){return;}
	}
	return Tribe.fromLast(offset);
};
Tribe.prototype.migrate = function()
{
	var heg = Tribe.strongestUniversalist();
	if(!heg || heg === this){return;}
	var hegGen = heg.gen();
	var gen = this.gen();
	switch(gen.mode)
	{
		case 2:
			if(this.gen().partialist){return;}
			var lenWomen = gen.women.length;
			var lenMen = parseInt(lenWomen * 0.2 );
			if(lenMen > gen.men.length)
			{
				lenMen = gen.men.length;
			}
			var lenIncels = gen.men.length - lenMen;
			var lenFeminists = lenWomen % lenMen;
			if(lenIncels)
			{
				var incels = gen.men.splice(0, lenIncels);
				incels.forEach((incel)=>{
					incel.setHost(heg);
				});
				hegGen.men = [...incels, ...hegGen.men];
                gen.emigration += incels.length.toString().concat(' men to ', heg.state, '; ');
                hegGen.immigration += incels.length.toString().concat(' men from ', this.state, '; ');
			}
			if(lenFeminists)
			{
				var feminists = gen.women.splice(0, lenFeminists);
				feminists.forEach((feminist)=>{
					feminist.setHost(heg);
				});
				hegGen.women = [...feminists, ...hegGen.women];
                gen.emigration += feminists.length.toString().concat(' women to ', heg.state, '; ');
                hegGen.immigration += feminists.length.toString().concat(' women from ', this.state, '; ');
			}
			break;
		case 1:
			var genderGap, femaleSurplus, maleSurplus, men, women;
			femaleSurplus = gen.women.length > gen.men.length;
			maleSurplus = gen.men.length > gen.women.length;
			if( femaleSurplus )
			{
				genderGap = gen.women.length - gen.men.length;
				women = gen.women.splice(0, genderGap);
				women.forEach((woman)=>{
					woman.setHost(heg);
				});
				hegGen.women = [...women, ...hegGen.women];
                gen.emigration += women.length.toString().concat(' women to ', heg.state, '; ');
                hegGen.immigration += women.length.toString().concat(' women from ', this.state, '; ');
			}
			else if( maleSurplus )
			{
				genderGap = gen.men.length - gen.women.length;
				men = gen.men.splice(0, genderGap);
				men.forEach((man)=>{
					man.setHost(heg);
				});
				hegGen.men = [...men, ...hegGen.men];
                gen.emigration += men.length.toString().concat(' men to ', heg.state, '; ');
                hegGen.immigration += men.length.toString().concat(' men from ', this.state, '; ');
			}
			break;
	}
};
Tribe.prototype.gen = function()
{
	return this.data[this.idx];
};
Tribe.prototype.strongerThan = function(tribe)
{
	return this.strength() > tribe.strength();
};
Tribe.prototype.warFund = function()
{
	var gen = this.gen();
	var commonerMen = parseInt(gen.men.length * 0.8);
	var eliteMen = parseInt(gen.men.length * 0.2);
	var commonerTax = commonerMen * this.commonerMaleBudget;
	var eliteTax = eliteMen * this.eliteMaleBudget;
	var warFund = eliteTax + commonerTax;
	this.conquered.forEach((tribe)=>{
		warFund += tribe.warFund();
	});
	return warFund;
};
Tribe.prototype.strength = function(only)
{
	var men = this.gen().men;
	var GQsum = 0;
	men.forEach((man)=>{
		if(man.tribe !== this){return;}
		GQsum += man.geneticQuality;
	});
	var avgGQS = (GQsum / men.length) || 0;
	var strength = this.warFund() * avgGQS * this.multiplier;
	if(only){return strength;}
	if(this.ruler)
	{
		return this.ruler.strength();
	}
	this.conquered.forEach((tribe)=>{
		strength += tribe.strength(true);
	});
	return strength;
};
Tribe.prototype.reproduce = function()
{
    var gen = Generation.populate(this);
    this.data.push(gen);
	this.idx++;
};
Tribe.prototype.reciprocity = function()
{
	if(this.ruler)
	{
		return this.attack(this.ruler);
	}
	var self = this;
    var attacks = this.gen().attacks;
    for(var i in attacks)
    {
        if( attacks[i].tribe.ruler ){continue;}
        if( !this.attack(attacks[i].tribe, attacks[i].hot) ){break;}
    }
};
Tribe.prototype.conquest = function()
{
	if(this.ruler)
	{
		return this.attack(this.ruler);
	}
	this.reciprocity();
    for(var i in Tribe.tribes)
    {
		var tribe = Tribe.tribes[i];
		var target = tribe.ruler || tribe;
		if(target === this || !target.gen().men.length){continue;}
        if( !this.attack(target) ){break;}
    }
};
Tribe.prototype.coldWar = function(tribe)
{
	var gen = tribe.gen();
	if(this === tribe || !gen.men.length || !gen.women.length){return true;}
    if(gen.partialist && !Tribe.diaspora){return true;}
	var self = this;
	var bottomHeaviness = gen.bottomHeaviness();
    if(Tribe.diaspora)
    {
        bottomHeaviness += ( (1 - bottomHeaviness) / 10 )
    }
	tribe.multiplier *= bottomHeaviness;
    this.multiplier /= bottomHeaviness
    gen.attacks.push({tribe: self, hot: false});
    self.gen().attacked.push({tribe: tribe, hot: false});
    return true;
};
Tribe.prototype.surrender = function()
{
    var rCost = this.warFund();
    var gen = this.gen();
    var sexRatio = gen.women.length / gen.men.length;
    var nsf = this.warFund() <= (rCost * 0.2)
    var nsm = sexRatio > 4;
	return nsf || nsm;
};
Tribe.prototype.hotWar = function(tribe)
{
	var self = this;
	var enemy = tribe.army(true);
	var army = self.army();
	var death = {
		true: ()=>{return enemy.shift();},
		false: ()=>{return army.shift();}
	};
	var victory = false;
	var surrender = {
		true: ()=>{
			if( !tribe.surrender() ){return;}
			var leader = enemy.pop();
			if(leader){ leader.die(); }
			victory = true;
			if( !self.partialist ){return true;}
			if(tribe.ruler)
			{
				var idx = tribe.ruler.conquered.indexOf(tribe);
				tribe.ruler.conquered.splice(idx, 1);
				tribe.ruler.gen().attacks.push({tribe: self, hot: true});
			}
			tribe.ruler = self;
			self.conquered.push(tribe);
			self.conquered = [...self.conquered, ...tribe.conquered];
			tribe.conquered = [];
			self.conquered.forEach((colony)=>{
				colony.ruler = self;
			});
			return true;
		},
		false: ()=>{return self.surrender();}
	};
	
	var win = true;
	var fight = function()
	{
        win = army[0].compete(enemy[0]);
        var loser = death[win.toString()]();
		loser.die();
	};
	
	var idx = 0;
	if(!enemy.length){surrender[true]();}
	while( army.length && enemy.length && !surrender[win]() )
	{
		fight();
	}
	tribe.gen().attacks.push({tribe: self, hot: true});
	self.gen().attacked.push({tribe: tribe, hot: true});
	return victory;
};
Tribe.prototype.attack = function(tribe, hot=true)
{
	if(this === tribe){return true;}
	if( !Tribe.diaspora && hot && !this.surrender() && this.strongerThan(tribe) && tribe !== SocialParasite.self )
	{
		return this.hotWar(tribe);
	}
	return this.coldWar(tribe);
};
Tribe.prototype.strategyName = function(strategy)
{
	return Tribe.strategyNames[strategy || this.strategy];
};
Tribe.prototype.systemName = function(mode)
{
	return Tribe.systemNames[mode || this.mode];
};
Tribe.prototype.ethicsName = function(partialist)
{
	return Tribe.ethicsNames[partialist || this.partialist];
};
Tribe.prototype.defVote = function()
{
    var gen = this.gen();
    var self = this;
    ['mode', 'strategy', 'partialist'].forEach((key)=>{
        gen[key] = self[key];
    });
	gen.decision = this.systemName(gen.mode).concat(
        ", ", this.strategyName(gen.strategy),
        ", ", this.ethicsName(gen.partialist)
    );
};
Tribe.prototype.vote = function()
{
    if(this.partialist)
    {
        return this.defVote();
    }
	var gen = this.gen();
	var men = gen.men.slice( parseInt(gen.men.length * 0.8) );
	var women = gen.women.slice( parseInt(gen.women.length * 0.8) );
	var votes = [];
	var mimickee = SocialParasite.mimickee();
    var badVotes = 0;
	[...women, ...men].forEach((human)=>{
		if( !human.isInfected() )
		{
			votes.push( human.vote() );
			return;
		}
        badVotes++;
		votes.push({
			mode: mimickee.mode,
			strategy: mimickee.strategy,
			partialist: mimickee.partialist
		});
	});
	var tally = {
		mode: [0, 0, 0],
		strategy: [0, 0, 0],
		partialist: {true: 0, false: 0}
	};
	votes.forEach((vote)=>{
		for (var val in vote)
		{
			tally[val][ vote[val] ]++;
		}
	});
	for (var val in tally)
	{
		if(tally[val].constructor === Array)
		{
			gen[val] = tally[val].indexOf(
				Math.max( ...tally[val] )
			);
			continue;
		}
		gen[val] = eval(Object.keys(tally[val]).reduce(
			(a, b) => tally[val][a] > tally[val][b] ? a : b
		));
	}
    gen.decision = this.systemName(gen.mode).concat(
        ", ", this.strategyName(gen.strategy),
        ", ", this.ethicsName(gen.partialist)
    );
};
Tribe.prototype.act = function()
{
	Tribe.strategies[this.gen().strategy].bind(this)();
};
Tribe.strengthDiff = function(a, b)
{
	var strength = function(tribe)
	{
		if(tribe.ruler)
		{
			return tribe.strength(true);
		}
		return tribe.strength();
	};
	return strength(a) - strength(b);
};
Tribe.prototype.army = function(only)
{
	var main = this.gen().men;
	var armies = [ [...main] ];
	if(!only)
	{
		this.conquered.forEach((tribe)=>{
			armies.push( [...tribe.gen().men] );
		});
	}
	var army = [];
	var idx = -1;
	var noneCount = 0
	while( noneCount !== armies.length )
	{
		idx++;
		if( idx === armies.length )
		{
			idx = 0;
		}
		if( !armies[idx].length )
		{
			noneCount++;
			continue;
		}
		army.push( armies[idx].splice(0, 1)[0] );
		noneCount = 0;
	}
	return army;
};
Tribe.strategies = [()=>{}, Tribe.prototype.reciprocity, Tribe.prototype.conquest];
Tribe.strategyNames = ['defence', 'reciprocity', 'conquest'];
Tribe.systemNames = ['polyandry', 'monogamy', 'polygyny'];
Tribe.ethicsNames = {true: 'partialist', false: 'universalist'};
function SocialParasite()
{
	Tribe.call(this, 
	{
		mode: 2, 
		strategy: 2, 
		partialist: true, 
		state: 'Social Parasite'
	});
	SocialParasite.self = this;
}
SocialParasite.prototype = Object.create(Tribe.prototype);
SocialParasite.prototype.infect = function(host)
{
	var hostGen = host.gen();
	var topWoman = hostGen.women.length - 1;
    var eliteWomen = parseInt(hostGen.women.length * 0.2);
	var lenBrides = parseInt(eliteWomen * 0.1) || 1;
	var women = hostGen.women.splice((topWoman - lenBrides + 1), topWoman );
	var gen = this.gen();
	women.forEach((woman)=>{
		woman.convert(this);
		gen.women.push(woman);
	}, this);
};
SocialParasite.prototype.act = function()
{
    var hosts = [];
	var add;
    if (Tribe.diaspora)
    {
		add = function(tribe)
		{
			if(tribe === this){return;}
			hosts.push(tribe);
		};
    }
    else
    {
        add = function(tribe)
		{
			if(tribe.partialist){return;}
			hosts.push(tribe);
		};
    }
	Tribe.tribes.forEach(add, this);
    hosts.forEach(function(host) {
        this.infect(host);
        this.coldWar(host);
    }, this);
};
SocialParasite.mimickee = function()
{
	return Tribe.tribes[0];
};
SocialParasite.infiltrators = [ [] ];
SocialParasite.prototype.migrate = function(){};
Tribe.setTribes = function()
{
	Tribe.tribes = [
		new Tribe({mode: 0, strategy: 0, partialist: false}),
		new Tribe({mode: 1, strategy: 0, partialist: false}),
		new Tribe({mode: 0, strategy: 1, partialist: false}),
		new Tribe({mode: 2, strategy: 0, partialist: false}),
		new Tribe({mode: 0, strategy: 2, partialist: false}),
		new Tribe({mode: 1, strategy: 1, partialist: false}),
		new Tribe({mode: 2, strategy: 1, partialist: false}),
		new Tribe({mode: 1, strategy: 2, partialist: false}),
		new Tribe({mode: 2, strategy: 2, partialist: false}),
		new Tribe({mode: 0, strategy: 0, partialist: true}),
		new Tribe({mode: 1, strategy: 0, partialist: true}),
		new Tribe({mode: 0, strategy: 1, partialist: true}),
		new Tribe({mode: 2, strategy: 0, partialist: true}),
		new Tribe({mode: 0, strategy: 2, partialist: true}),
		new Tribe({mode: 1, strategy: 1, partialist: true}),
		new Tribe({mode: 2, strategy: 1, partialist: true}),
		new Tribe({mode: 1, strategy: 2, partialist: true}),
		new Tribe({mode: 2, strategy: 2, partialist: true}),
		new SocialParasite()
	];
	if(!Tribe.orderByDespotypy){Tribe.tribes.reverse();}
	return Tribe.progress(0);
};
function Human(tribe, isMale, admixture)
{
	this.tribe = tribe;
    this.isMale = isMale;
	this.admixture = admixture;
	this.children = [];
	this.setGQS();
}
Human.getAdmixture = function(man, woman)
{
	var admixture = {};
	Tribe.tribes.forEach((tribe)=>{
		var score = (woman.admixture[tribe.state] || 0) + (man.admixture[tribe.state] || 0);
		var avg = score / 2;
		var mutationRate = 0.0025;
		if( man.randBool() )
		{
			mutationRate *= -1;
		}
		var difference = avg * mutationRate;
		admixture[tribe.state] = avg + difference;
	});
    return admixture;
};
Human.prototype.setGQS = function()
{
	this.geneticQuality = 0;
	if(this.tribe !== SocialParasite.self)
	{
		this.geneticQuality += this.admixture[this.tribe.state];
		return;
	}
	for(var state in this.admixture)
	{
		this.geneticQuality += this.admixture[state];
	}
};
Human.prototype.siblings = function()
{
	var self = this;
	var children = [
		...self.mother.children,
		...self.father.children
	];
	var siblings = [...new Set(children)];
	var idx = siblings.indexOf(this);
	siblings.splice(idx, 1);
	return siblings;
};
Human.prototype.parentSiblings = function()
{
	var self = this;
	var siblings = [
		...self.mother.siblings(),
		...self.father.siblings()
	];
	return [...new Set(siblings)];
};
Human.prototype.cousins = function()
{
	var cousins = [];
	this.parentSiblings().forEach((sib)=>{
		sib.children.forEach((sib)=>{
			cousins.push(sib);
		});
	});
	return [...new Set(cousins)];
};
Human.prototype.family = function()
{
    if( this.tribe.idx < 2)
    {
        return [];
    }
	var self = this;
	return [
		self.mother, self.father,
		...self.parentSiblings(),
		...self.siblings(),
		...self.cousins()
	];
};
Human.prototype.isInfected = function()
{
	var infected = false;
	this.family().forEach((member)=>{
		if(member.host)
		{
			infected = true;
		}
	});
	return infected;
};
Human.prototype.vote = function()
{
	var tribe = this.tribe;
	return {
		mode: tribe.mode,
		strategy: tribe.strategy,
		partialist: tribe.partialist
	};
};
Human.prototype.setHost = function(tribe)
{
	this.host = tribe;
};
Human.prototype.addIfInfiltrator = function()
{
    if( (this.tribe === SocialParasite.self) && this.host )
	{
		var idx = SocialParasite.infiltrators.length - 1;
		SocialParasite.infiltrators[idx].push(this);
	}
};
function Woman(tribe, admixture)
{
    Human.call(this, tribe, false, admixture);
}
Woman.prototype = Object.create(Human.prototype);
Woman.prototype.newHuman = function(gender, admixture)
{
	var human = new gender(this.tribe, admixture);
	human.setHost(this.host);
	return human;
};
Woman.prototype.newMan = function(admixture)
{
	return this.newHuman(Man, admixture);
};
Woman.prototype.newWoman = function(admixture)
{
	return this.newHuman(Woman, admixture);
};
Woman.prototype.convert = function(tribe)
{
	this.setHost(this.tribe);
	this.tribe = tribe;
	this.setGQS();
};
function Man(tribe, admixture)
{
    Human.call(this, tribe, true, admixture);
}
Man.prototype = Object.create(Human.prototype);
Man.prototype.randBool = function()
{
    return Math.random() < 0.5;
};
Man.prototype.die = function(host)
{
	var tribe = host || this.tribe;
	var men = tribe.gen().men;
	var idx = men.indexOf(this);
	men.splice(idx, 1);
	if(!this.host || host){return;}
	this.die(this.host);
};
Man.prototype.impregnate = function(woman)
{
	var admixture = Human.getAdmixture(this, woman);
	var gender = (this.randBool()) ? 'newMan': 'newWoman';
	var child = woman[gender](admixture);
	child.father = this;
	child.mother = woman;
	this.children.push(child);
	woman.children.push(child);
	return child;
};
Man.prototype.breed = function(tribe, woman, maxChildren)
{
    var children = [];
    for (var i = 0; i < Math.min(tribe.children, maxChildren); i++)
    {
        var child = this.impregnate(woman);
        children.push(child);
    }
    return children;
};
Man.prototype.compete = function(man)
{
	var count = parseInt(this.geneticQuality / man.geneticQuality * 10 * man.tribe.multiplier);
	var probs = [];
	for(var i=0; i < (10 * this.tribe.multiplier ); i++)
	{
		probs.push(true);
	}
	for(var j=0; j < count; j++)
	{
		probs.push(false);
	}
	probs.sort(() => Math.random() - 0.5);
	var idx = Math.floor(Math.random() * probs.length);
    if( !(idx in probs) )
    {
        return this.tribe.multiplier >= man.tribe.multiplier;
    }
	return probs[idx];
};
function Generation(tribe)
{
    this.men = [];
    this.women = [];
    this.pos = tribe.idx + 1;
	this.attacks = [];
    this.attacked = [];
	this.tribe = tribe;
    this.immigration = '';
    this.emigration = '';
}
Generation.prototype.genePool = function(gen)
{
    var gen = this;
	var tally = {};
	Tribe.tribes.forEach((tribe)=>{
		tally[tribe.state] = 0;
	});
	[...gen.men, ...gen.women].forEach((human)=>{
		for( var geneSet in human.admixture )
		{
			tally[geneSet] += (human.admixture[geneSet] || 0);
		}
	});
	var nullList = [];
	for( var geneSet in tally )
	{
		if( tally[geneSet] === 0 )
		{
			nullList.push(geneSet);
		}
	}
	nullList.forEach((geneSet)=>{
		delete tally[geneSet];
	});
	
	var total = 0;
	for( var geneSet in tally )
	{
		total += tally[geneSet];
	}
	
	var genePool = {};
	for( var geneSet in tally )
	{
		var prc = tally[geneSet] / total * 100;
		genePool[geneSet] = (prc).toFixed(2).concat('%');
	}
	var data = [];
	for( var geneSet in genePool )
	{
		data.push( genePool[geneSet] );
		data.push(' ');
		data.push( geneSet );
		data.push(', ')
	}
	data.pop();
	return data.join('');
};
Generation.prototype.statistics = function()
{
    var commonerMen = parseInt(this.men.length * 0.8);
    var commonerWomen = parseInt(this.women.length * 0.8);
    var eliteMen = parseInt(this.men.length * 0.2);
    var eliteWomen = parseInt(this.women.length * 0.2);
	var parasiteCount = 0;
	var parasiteScore = 0;
    
    var commonerMaleScore = 0;
	var commonerMaleCount = commonerMen;
    for(let i = 0; i < commonerMen; i++)
    {
		if(this.tribe !== SocialParasite.self && this.men[i].tribe === SocialParasite.self)
		{
			commonerMaleCount--;
			parasiteCount++;
			parasiteScore += this.men[i].geneticQuality;
			continue;
		}
        commonerMaleScore += this.men[i].geneticQuality;
    }
    var commonerMaleAvg = commonerMaleScore / commonerMaleCount;
    
    var eliteMaleScore = 0;
	var eliteMaleCount = eliteMen;
    for(let i = commonerMen; i < this.men.length; i++)
    {
		if(this.tribe !== SocialParasite.self && this.men[i].tribe === SocialParasite.self)
		{
			eliteMaleCount--;
			parasiteCount++;
			parasiteScore += this.men[i].geneticQuality;
			continue;
		}
        eliteMaleScore += this.men[i].geneticQuality;
    }
    var eliteMaleAvg = eliteMaleScore / eliteMaleCount;
    
    var commonerFemaleScore = 0;
	var commonerFemaleCount = commonerWomen;
    for(let i = 0; i < commonerWomen; i++)
    {
		if(this.tribe !== SocialParasite.self && this.women[i].tribe === SocialParasite.self)
		{
			commonerFemaleCount--;
			parasiteCount++;
			parasiteScore += this.women[i].geneticQuality;
			continue;
		}
        commonerFemaleScore += this.women[i].geneticQuality;
    }
    var commonerFemaleAvg = commonerFemaleScore / commonerFemaleCount;
    
    var eliteFemaleScore = 0;
	var eliteFemaleCount = eliteWomen;
    for(let i = commonerWomen; i < this.women.length; i++)
    {
		if(this.tribe !== SocialParasite.self && this.women[i].tribe === SocialParasite.self)
		{
			eliteFemaleCount--;
			parasiteCount++;
			parasiteScore += this.women[i].geneticQuality;
			continue;
		}
        eliteFemaleScore += this.women[i].geneticQuality;
    }
    var eliteFemaleAvg = eliteFemaleScore / eliteFemaleCount;
    var self = this;
	var ruler,conquered;
	if(!self.tribe.ruler)
	{
		ruler = 'none';
		var colonies = [];
		self.tribe.conquered.forEach((tribe)=>{
			colonies.push(tribe.state);
		});
		conquered = colonies.join('; ');
	}
	else
	{
		ruler = self.tribe.ruler.state;
		conquered = 'none';
	}
    var attacks = [];
    self.attacks.forEach((attack)=>{
        attacks.push(attack.tribe.state.concat(', ', (attack.hot) ? 'Hot War': 'Cold War') );
    });
    var attacked = [];
    self.attacked.forEach((attack)=>{
        attacked.push(attack.tribe.state.concat(', ', (attack.hot) ? 'Hot War': 'Cold War') );
    });
    var ghettoSum = 0;
    this.women.forEach((woman)=>{
		if(this.tribe !== SocialParasite.self && woman.tribe === SocialParasite.self){return;}
        ghettoSum += woman.geneticQuality;
     });
	this.men.forEach((man)=>{
		if(this.tribe !== SocialParasite.self && man.tribe === SocialParasite.self){return;}
		ghettoSum += man.geneticQuality;
	});
	var ghettoGQS = ghettoSum / (self.women.length + self.men.length);
    var data = {
		"Tribe": self.tribe.state,
		"Ruled by": ruler,
        "Decision": self.decision,
		"Conquered": conquered,
        "Attacked": attacked.join('; '),
        "Attacked By": attacks.join('; '),
        "Pop. Size of Generation": self.men.length + self.women.length,
		"Emigration": self.emigration,
        "Immigration": self.immigration,
        "Number of Men": self.men.length,
        "Number of Women": self.women.length,
        "Elite Male Average GQS": eliteMaleAvg,
        "Elite Female Average QGS": eliteFemaleAvg,
        "Commoner Male Average GQS": commonerMaleAvg,
        "Commoner Female Average GQS": commonerFemaleAvg,
        "Average GQS": ghettoGQS,
		"Gene Pool": self.genePool()
    };
	if(self.tribe === SocialParasite.self)
	{        
		var gqsSum = 0;
        var idx = SocialParasite.infiltrators.length - 1;
		SocialParasite.infiltrators[idx].forEach((parasite)=>{
			gqsSum += parasite.geneticQuality;
		});
		var avgGQS = gqsSum / SocialParasite.infiltrators[idx].length;
		data["Diaspora Average GQS"] = avgGQS;
	}
	else
	{
		data["Average GQS of Social Parasite"] = parasiteScore / parasiteCount;
	}
	return data;
};
Generation.prototype.bottomHeaviness = function()
{
    var commonerMen = parseInt(this.men.length * 0.8);
	var eliteMen = parseInt(this.men.length * 0.2);
	
    var commonerMaleScore = 0;
    for(let i = 0; i < commonerMen; i++)
    {
        commonerMaleScore += this.men[i].geneticQuality;
    }
    var commonerMaleAvg = commonerMaleScore / commonerMen;
    
    var eliteMaleScore = 0;
    for(let i = commonerMen; i < this.men.length; i++)
    {
        eliteMaleScore += this.men[i].geneticQuality;
    }
    var eliteMaleAvg = eliteMaleScore / eliteMen;
	return 1 - (commonerMaleAvg / eliteMaleAvg);
};
Generation.prototype.ascending = function(a, b)
{
    return a.geneticQuality - b.geneticQuality;
};
Generation.prototype.sortMen = function()
{
    this.men.sort(this.ascending);
};
Generation.prototype.sortWomen = function()
{
    this.women.sort(this.ascending);
};
Generation.prototype.sortAll = function()
{
    this.sortMen();this.sortWomen();
};
Generation.prototype.shuffle = function(people){
    people.sort(() => Math.random() - 0.5);
};
Generation.prototype.randomize = function(){
    this.shuffle(this.men);
    this.shuffle(this.women);
};
Generation.first = function(tribe)
{
    var self = new this(tribe);
	var commonerAdmixture = {};
	commonerAdmixture[tribe.state] = tribe.commonerGQS;
	var eliteAdmixture = {};
	eliteAdmixture[tribe.state] = tribe.eliteGQS;
    for( let i = 0; i < 40; i++ )
    {
        self.men.push( new Man( tribe, commonerAdmixture ) );
        self.women.push(  new Woman( tribe, commonerAdmixture ) );
    }
    for( let i = 0; i < 10; i++ )
    {
        self.men.push( new Man( tribe, eliteAdmixture ) );
        self.women.push( new Woman( tribe, eliteAdmixture ) );
    }
    return self;
};
Generation.prototype.limit = function()
{
	var pop = this.men.length + this.women.length;
	return pop >= Tribe.maxPop;
};
Generation.prototype.pair = function(men, women, length)
{
    var eliteThreshold = parseInt(this.tribe.gen().men.length * 0.2);
	length = length || women.length;
    for( let i = 0; i < length; i++ )
    {
        var woman = women[i];
        var man = men[i];
        if(!man || !woman){break;}
        var budget;
        if( i > eliteThreshold )
        {
            budget = this.tribe.eliteMaleBudget;
        }
        else
        {
            budget = this.tribe.commonerMaleBudget;
        }
        var maxChildren = parseInt(budget / this.tribe.costPerChild);
        
        man.breed(this.tribe, woman, maxChildren).forEach((child)=>{
			var gen = (woman.host) ? woman.host.gen(): this;
			if(gen.limit()){return;}
            child.addIfInfiltrator(gen);
			if(child.isMale)
			{
				gen.men.push(child);
				return;
			}
			gen.women.push(child);
        });
    }
};
Generation.monogamy = function(tribe)
{
    var self = new Generation(tribe);
    var gen = tribe.gen();
    var genderGap, femaleSurplus, maleSurplus, men, women;
	femaleSurplus = gen.women.length > gen.men.length;
	maleSurplus = gen.men.length > gen.women.length;
    if( femaleSurplus )
    {
        genderGap = gen.women.length - gen.men.length;
		women = gen.women.slice(genderGap);
		men = gen.men;
    }
    else if( maleSurplus )
    {
        genderGap = gen.men.length - gen.women.length;
        men = gen.men.slice(genderGap);
		women = gen.women;
    }
	else
	{
		men = gen.men;
		women = gen.women;
	}
	self.pair(men, women);
	
	// adultery
	if( maleSurplus )
	{
		var incels = gen.men.slice(0, genderGap);
		self.pair( incels, women, incels.length);
	}
	if( femaleSurplus )
	{
		self.pair( men, gen.women.slice(0, genderGap));
	}
	
    self.sortAll();
    return self;
};
Generation.prototype.match = function(men, women, length, ratio)
{
    for( var i = 0; i < length; i++ )
    {
        var man = men[i];
        if(!man){break;}
        var maxChildren = parseInt(this.tribe.eliteMaleBudget / this.tribe.costPerChild);
        var maxPerWoman = parseInt(maxChildren / ratio);
        
        var harem = [];
        var idx = 0;
        while(idx < ratio)
        {
			var woman = women.shift();
			if( !woman ){return;}
            harem.push( woman );
            idx++;
        }
        harem.forEach((woman)=>{
			var gen = (woman.host) ? woman.host.gen(): this;
            man.breed(this.tribe, woman, maxPerWoman).forEach((child)=>{
				if(gen.limit()){return;}
                child.addIfInfiltrator(gen);
                if(child.isMale)
                {
                    gen.men.push(child);
                    return;
                }
                gen.women.push(child);
            });
        });
    }
};
Generation.polygyny = function(tribe)
{
    var self = new Generation(tribe);
    var gen = tribe.gen();
    var lenWomen = gen.women.length;
    var lenMen = parseInt(lenWomen * 0.2 );
    var lenIncels = gen.men.length - lenMen;
    if(lenIncels < 0){lenIncels = 0;}
    var lenFeminists = lenWomen % lenMen;
    lenWomen -= lenFeminists;
    
	var women = gen.women.slice(lenFeminists);
    var men = gen.men.slice(lenIncels);
    var ratio = lenWomen / lenMen;
	self.match(men, women, lenMen, ratio);
	// adultery
	var lenMutants = lenFeminists % lenMen;
	var feminists = gen.women.slice(lenMutants, lenFeminists);
	ratio = Math.round(feminists.length / lenMen) || 1;
	var length = (lenMutants) ? lenMen : feminists.length;
	self.match(men, feminists, length, ratio);
	
    self.sortAll();
    return self;
};
Generation.polyandry = function(tribe)
{
    var self = new Generation(tribe);
    var gen = tribe.data[tribe.idx];
    var lenWomen = gen.women.length;
    var lenMen = gen.men.length;
    var lenFeminists;
    if(lenMen < lenWomen)
    {
        lenFeminists = lenWomen - lenMen;
        lenWomen -= lenFeminists;
    }
    else
    {
        lenFeminists = 0;
    }
    var lenIncels = lenMen % lenWomen;
    lenMen -= lenIncels;
    var men = gen.men.splice(0, lenMen);
    var women = gen.women.splice(0, lenWomen);
    var ratio = lenMen / lenWomen;
    
    for( let i = 0; i < lenWomen; i++)
    {
        var woman = women[i];
        var harem = [];
        var idx = 0;
        while(idx < ratio)
        {
            harem.push( men.shift() );
            idx++;
        }
        var count = 0;
        while(tribe.children > count && !self.limit())
        {
            harem.forEach((man)=>{
				if(self.limit()){return;}
                count++;
                if(tribe.children < count){return;}
                var child = man.impregnate(woman);
                child.addIfInfiltrator(self);
                if(child.isMale)
                {
                    self.men.push(child);
                    return;
                }
                self.women.push(child);
                
            });
        }
    }
    self.randomize();
    return self;
};
Generation.populate = function(tribe)
{
    return this.systems[tribe.gen().mode](tribe);
};
Generation.systems = [Generation.polyandry, Generation.monogamy, Generation.polygyny];

Example Use of Framework

Dependencies: Religious Competition Computer Model Framework & Bootstrap

<!-- 
| Religious Competition Simulator
| Apollonian Regime (c) 2023
| https://apollonianregime.com/genosupremacy-religious-competition-simulator
| License: MIT
 -->
<script type="text/javascript">
var css = {
    head: document.getElementsByTagName('head')[0],
    insert: function(file)
    {
        var css = document.createElement("link");
        css.href = "/wp-content/bootstrap-v5.2.0/".concat(file);
        css.rel="stylesheet";
        this.head.appendChild(css);
    },
};
css.insert('min.css');
</script>
<div class="row col-md-8 d-block mx-auto">
    <div class="form-group"><p class="mb-0"><b>Download:</b> <a href="/wp-content/genosupremacy.js" download>Religious Competition Computer Model Framework</a></p></div>
    <div class="form-group mb-2 mt-4"><input oninput="Tribe.maxPop=parseInt(this.value)" class="form-control" type="number" min="0" max="100000" placeholder="Max Population (100k)"></div>
    <div class="form-check" style="padding-left:3.5em">
      <input onchange="Tribe.orderByDespotypy = !Tribe.orderByDespotypy" class="form-check-input" type="checkbox" id="order" checked>
      <label class="form-check-label" for="order">Order tribes by despotypy</label>
    </div>
    <div class="form-check mb-3" style="padding-left:3.5em">
      <input onchange="Tribe.diaspora = !Tribe.diaspora" class="form-check-input" type="checkbox" id="diaspora">
      <label class="form-check-label" for="diaspora">Diaspora mode</label>
    </div>
    <button onclick="control.loading();setTimeout(control.exe.bind(control), 400);" class="btn btn-xl btn-warning mt-4 mb-5 w-75 mx-auto d-block"><b>Generate Data</b></button>
    <div id="ms-btns" class="btn-group mt-4 mb-5 d-block mx-auto text-center d-none">
      <button type="button" class="btn btn-dark mr-2" onclick="control.prev();">Previous generation</button>
      <button type="button" class="btn btn-dark" onclick="control.next();">Next generation</button>
    </div>
    <div id="ms-box">
    </div>
</div>
<script type="text/javascript" src="/wp-content/bootstrap-v5.2.0/bundle.min.js"></script>
<script type="text/javascript" src="/wp-content/genosupremacy.js"></script>
<script type="text/javascript">
var control = {
    view: document.getElementById('ms-box'),
    btns: document.getElementById('ms-btns'),
    loading: function()
    {
        this.view.innerHTML = '<img src="/wp-content/uploads/2023/04/loading.gif" class="img-fluid d-block mx-auto" alt="Loading...">';
    },
    tribeData: function(data)
    {
        var html = [];
        for( var key in data )
        {
            ['<p class="mb-0 pb-0"><b>', key, ':</b> ', data[key], '</p>'].forEach((str)=>{
                html.push(str);
            });
        }
        html.push('<p>----------</p>');
        control.view.innerHTML += html.join('');
    },
    genData: function(gen)
    {
        this.view.innerHTML += '<p class="mb-0 pb-0"><b>Generation: </b>'.concat(this.idx.toString(), '</p><p>----------</p>');
        gen.forEach(this.tribeData);
    },
    set: function()
    {
        this.genData( this.gens[this.idx] );
    },
    prev: function()
    {
        if(this.idx === 0){return;}
        this.view.innerHTML = '';
        this.idx--;
        this.set();
    },
    next: function()
    {
        if(this.idx === 9){return;}
        this.view.innerHTML = '';
        this.idx++;
        this.set();
    },
    exe: function()
    {
        this.idx = 0;
        this.gens = religiousCompetition();
        this.btns.classList.remove('d-none');
        this.view.innerHTML = '<p><b>Success:</b> <u>simulation complete</u></p>';
        this.set();
    }
};
</script>
Apollonian Regime Telegram Channel

Click to view.

Conceptual Open-Source License (COSL)

The original ideas and arguments presented herein are published under the COSL license.