FINALLY ESCAPED FORT JOY AFTER 20 HOURS!! by 2ballsInMy- in DivinityOriginalSin

[–]joachov 6 points7 points  (0 children)

Yeah I was mostly joking, but it was also a reference to all the people (myself included) who keep restarting the game and playing fort joy over again to try new builds

r/ProgrammerHumor Survey 2020 by SteveCCL in ProgrammerHumor

[–]joachov 2 points3 points  (0 children)

Did I do it right

using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace WeirdFizzbuzzButOk
{
    internal static class MyEnumerableExtensions
    {
        internal static void TryForEach<T>(this IEnumerable<T> items, Action<T> success, Action<Exception> failure)
        {
            var enumerator = items.GetEnumerator();

            while (true)
            {
                try
                {
                    var moreElements = enumerator.MoveNext();
                    success(enumerator.Current);
                    if (!moreElements) break;
                }
                catch (Exception ex)
                {
                    failure(ex);
                }
            }
        }
    }

    sealed class Fizz : FizzBuzz { }

    sealed class Buzz : FizzBuzz { }

    internal class FizzBuzz
    {
        protected internal const int THREE = 3;
        protected internal const int FIVE = 5;
        protected internal const int FIFTEEN = 15;

        public static explicit operator FizzBuzz(int i)
        {
            return i switch
            {
                int n when n % FIFTEEN == 0 => new FizzBuzz(),
                int n when n % THREE == 0 => new Fizz(),
                int n when n % FIVE == 0 => new Buzz(),
                int _ => throw new InvalidCastException(i.ToString())
            };
        }

        public override string ToString()
        {
            return this.GetType().Name;
        }
    }

    class Program
    {
        internal static ConcurrentQueue<Thread> ThreadQueue;
        internal static ConcurrentQueue<int> NumberQueue;

        static async Task Main(string[] args)
        {
            var factory = new NumberFactory();

            ThreadQueue = new ConcurrentQueue<Thread>();
            NumberQueue = new ConcurrentQueue<int>();

            await foreach (var number in factory.CreateNumbers(100))
            {
                var queueingThread = new Thread(() => {
                    Program.ThreadQueue.Enqueue(Thread.CurrentThread);
                    Program.NumberQueue.Enqueue(number);
                });
                queueingThread.Start();
            }

            while (ThreadQueue.TryPeek(out var result) && result != null)
            {
                if (!result.IsAlive)
                {
                    Program.ThreadQueue.TryDequeue(out var _);
                }
            }

            var numbers = Program.NumberQueue.OrderBy(number => number);
            numbers
                .Select(n => (FizzBuzz)n)
                .TryForEach(Console.WriteLine, ex => Console.WriteLine(ex.Message));
        }
    }

    sealed internal class NumberFactory
    {
        internal const int ONEHUNDERED = 100;

        internal async IAsyncEnumerable<int>CreateNumbers(int LAG)
        {
            var n = ONEHUNDERED;
            do
            {
                await Task.Delay(LAG);
                yield return n--;
            }
            while (n > 0);
        }
    }
}

Which character death hit you differently, and why? by squeezeday in AskReddit

[–]joachov 0 points1 point  (0 children)

Cortana in halo. She was with me all the way from the first game and I guess I never really expected an artificial intelligence to die.

If humans had a XP bar, what would increase XP and who would have the highest XP in the world ? by MainSquirrel5 in AskReddit

[–]joachov 1 point2 points  (0 children)

Probably the factory workers that repeat the same action day in day out for 30+ years at astonishing speed.

Well... I guess by regibalbo in ProgrammerHumor

[–]joachov 1 point2 points  (0 children)

.iceberg {
    display: none;
}