using System;
namespace AMessageToTheWorld {
public delegate void WhomYouKnowYouShouldGoto();
public static class Message2World {
private static Random _rand = new Random();
private static bool _enabled;
private static long _failCounter;
private static bool YouFail() => _failCounter > long.MaxValue / 2;
private static void YourBest() {
Console.WriteLine("Without giving it your all, you will fall.");
_failCounter += _rand.Next(int.MinValue, int.MaxValue);
}
private static void WhatYouNeedToDo() {
Console.WriteLine("Your Priorities are important right now.");
_failCounter += _rand.Next(int.MinValue, int.MaxValue);
}
private static void EveryTimeYouFall() {
Console.WriteLine("Get up!");
_failCounter = 0;
}
private static bool YouStillHaveTime() {
return (DateTime.MaxValue - DateTime.Now).TotalMilliseconds > 0;
}
public static void Begin() {
_enabled = true;
static void Always() {
try {
YourBest();
do {
WhatYouNeedToDo();
} while (YouStillHaveTime());
if(YouFail())
throw new Exception("All your worries");
}
catch (Exception yourself) {
EveryTimeYouFall();
}
}
WhomYouKnowYouShouldGoto _ = Always;
while (_enabled) _();
}
}
}
Comments
0 B
|👍
/👎