Blizzardo1 icon

A Message to the World

Blizzardo1 | PRO | 08/15/20 03:55:45 PM UTC | 0 ⭐ | 1984 👁️ | Never ⏰ | []
C# |

1.66 KB

|

None

|

0 👍

/

0 👎

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

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎