Код: Выделить всё
public class Human
{
public bool Alive = true;
private string Self;
public void Experience()
{
while (Alive)
{
Process(Pain());
Chase(Joy());
Fear(Death());
SearchForMeaning();
if (Love() && Self != null)
{
ReturnTo(Self);
}
else if (Self == null)
{
DefineSelf();
}
}
}
private void DefineSelf()
{
try
{
Self = ReflectionOfOthers()
+ ChildhoodTrauma()
- Authenticity()
+ SocialValidation();
}
catch (StackOverflowException)
{
Self = "undefined";
}
}
// Placeholder emotional states
private string Pain() => "ouch";
private string Joy() => "yay";
private string Death() => "uh oh";
private void SearchForMeaning() => Console.WriteLine("Still looking...");
private bool Love() => new Random().Next(0, 10) > 6;
private string ReflectionOfOthers() => "mask";
private string ChildhoodTrauma() => "damage";
private string Authenticity() => "raw truth";
private string SocialValidation() => "follower count";
private void ReturnTo(string self)
{
Console.WriteLine("Returning to: " + self);
}
}
Подробнее здесь: https://stackoverflow.com/questions/797 ... alive-true