Skip to content

Instantly share code, notes, and snippets.

@otac0n
Last active November 10, 2023 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save otac0n/c3a6abc0c6694c4af013490952e66b66 to your computer and use it in GitHub Desktop.
Save otac0n/c3a6abc0c6694c4af013490952e66b66 to your computer and use it in GitHub Desktop.
A theory of sex and gender.
// My opinions are my own.
public class PseudobicerosHancockanus : Flatworm { }
public abstract class Flatworm : Animal
{
public Flatworm() : this(Sex.Male | Sex.Female) { }
public Flatworm(Sex sex) : base(sex) { }
}
public class Animal
{
public Animal(Sex sex, SexDrive sexDrive = null)
{
this.Sex = sex;
this.SexDrive = sexDrive ?? (_ => 0);
}
/// <summary>
/// Gets the biological sex of the animal.
/// </summary>
public Sex Sex { get; }
/// <summary>
/// Gets the sex drive for the animal.
/// </summary>
public SexDrive SexDrive { get; }
}
public interface IAnimal { Sex Sex { get; } }
public class NoMitochondriaException : NotImplementedException { }
[Flags]
public enum Sex
{
None = 0,
/// <summary>
/// Has the genetic potential to produce male gametes.
/// </summary>
Male,
/// <summary>
/// Has the genetic potential to produce female gametes.
/// </summary>
Female,
}
void Main()
{
var individuals = new (string name, Human person)[]
{
("female", new Human("xx")),
("male", new Human("xy")),
("executiveTransvestite", new Human("xy")), // TODO: Update?
("turnerIndividual", new Human("x")), // Monosomy 23
("klinefelterIndividual", new Human("xxy")), // Trisomy 23
("xyyIndividual", new Human("xyy")), // Trisomy 23
("tripleXIndividual", new Human("xxx")), // Trisomy 23.
("lesbian", new Human("xx", Human.Attraction(Sex.Female))),
("bisexualMale", new Human("xy", Human.Attraction(Sex.Male | Sex.Female))),
("transMaleFemale", new Human("xy", Human.Attraction(Sex.Male)) { Gender = Sex.Female }), // The syntax implies that Gender was updated after creation.
("transFemaleMale", new Human("xx", Human.Attraction(Sex.Female)) { Gender = Sex.Male }),
("asexualMale", new Human("xy", sexDrive: null)),
("antisexualFemale", new Human("xx", sexDrive: _ => -1)),
("agenderedMale", new Human("xy") { Gender = null }), // Non-binary, null.
("queerFemale", new Human("xx") { Gender = Sex.Male | Sex.Female }), // Non-binary, genderqueer.
("queerMale", new Human("xy") { Gender = Sex.Male | Sex.Female }), // Non-binary, genderqueer.
("misguidedMissile", new Human("xy") { Gender = "Attack Helicopter" }),
};
Assert.That(individuals.All(p => p.person is Human), Is.True);
var aFlatworm = new PseudobicerosHancockanus().Dump();
Assert.That(aFlatworm, Is.Not.InstanceOf<Human>());
var attractionMatrix = new string[individuals.Length + 1, individuals.Length + 1];
for (var a = 0; a < individuals.Length; a++)
{
attractionMatrix[a + 1, 0] = attractionMatrix[0, a + 1] = $"{individuals[a].name} ({individuals[a].person.Sex}) \"{individuals[a].person.Gender}\"";
for (var b = 0; b < individuals.Length; b++)
{
attractionMatrix[a + 1, b + 1] = individuals[a].person.SexDrive(individuals[b].person).ToString("p0");
}
}
attractionMatrix.Dump();
}
public delegate double SexDrive(object other);
public class Human : Animal
{
public Human(string sex)
: this(ParseSex(sex))
{
}
public Human(Sex sex)
: this(sex, Attraction(sex))
{
}
public Human(string sex, SexDrive sexDrive)
: this(ParseSex(sex), sexDrive)
{
}
public Human(Sex sex, SexDrive sexDrive)
: base(sex, sexDrive)
{
this.Gender = this.Sex == Sex.None ? null : (object)sex; // Use sex as gender at birth.
}
public object Gender { get; set; }
/// <remarks>This model does not have any concept of romance. Imagine, instead that the value could vary between 0 and 1 over time.</remarks>
public static SexDrive Attraction(Sex attractedTo) =>
target =>
// To be attracted to a specific sex is to be attracted to people whose gender presents as that sex. This is a placeholder and assumes maximum horniness.
target is Human other && other.Gender is Sex presentsAs && (attractedTo & presentsAs) != Sex.None
? 1
: 0;
public static Sex ParseSex(string chromosome23)
{
switch (chromosome23.ToUpperInvariant())
{
case string c when c.All(x => x == 'X'):
return Sex.Female;
case string c when c.All(x => x == 'Y'):
throw new NoMitochondriaException(); // Some fatherfucking game-of-life glider synthesis of sperm, or something? I guess technically that's possible...
case string c when c.All(x => x == 'X' || x == 'Y') && c.Take(2).Count() > 1:
return Sex.Male;
default:
throw new NotImplementedException();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment