Beispiel #1
0
            static char[,] ApplyRules(char[,] input, RuleSet rules, int size)
            {
                var memory     = input.AsMemory2D();
                var panels     = input.GetLength(0) / size;
                var resultSize = size + 1;
                var newSize    = resultSize * panels;

                var result     = new char[newSize, newSize];
                var resultSpan = result.AsSpan2D();

                for (var y = 0; y < panels; y++)
                {
                    var yOffset       = y * size;
                    var resultYOffset = y * resultSize;

                    for (var x = 0; x < panels; x++)
                    {
                        var xOffset       = x * size;
                        var resultXOffset = x * resultSize;

                        var target = resultSpan[resultXOffset..(resultXOffset + resultSize), resultYOffset..(resultYOffset + resultSize)];