Example #1
0
        public static void testEveryColumn(State state, ref RuleData rule, PatternStorage patterns)
        {
            System.Console.WriteLine($"=== Test every column ===");
            var gridSize = state.gridSize;

            int h = gridSize.y;
            int w = gridSize.x;
            int n = patterns.len;

            for (int x = 0; x < w; x++)
            {
                for (int y = 0; y < h - 1; y++)
                {
                    var fromId = state.patternIdAt(x, y, n);
                    var toId   = state.patternIdAt(x, y + 1, n);
                    if (fromId == null || toId == null)
                    {
                        continue;
                    }
                    if (!rule.isLegal(fromId.Value, Dir4.S, toId.Value))
                    {
                        System.Console.WriteLine($"illegal: {x}, {y} ({fromId.Value.asIndex}) -> {x}, {y+1} ({toId.Value.asIndex})");
                    }
                }
            }
        }