Exemplo n.º 1
0
        protected ZobristHash ComputeZobrist(Pattern pattern, Color color)
        {
            int lSize = pattern.GetFullBoardSize();

            ZobristHash lZobristHash = new ZobristHash();

            for (int x = 0; x < lSize; x++)
                for (int y = 0; y < lSize; y++)
                    switch (pattern.GetCell(x, y))
                    {
                        case 'X': lZobristHash.Delta(color.IsBlack ? Color.Black : Color.White, CoordinateSystem.At(x, y, lSize)); break;
                        case 'O': lZobristHash.Delta(color.IsBlack ? Color.White : Color.Black, CoordinateSystem.At(x, y, lSize)); break;
                    }

            return lZobristHash;
        }
        protected ZobristHash ComputeZobrist(Pattern pattern, Color color)
        {
            int lSize = pattern.GetFullBoardSize();

            ZobristHash lZobristHash = new ZobristHash();

            for (int x = 0; x < lSize; x++)
            {
                for (int y = 0; y < lSize; y++)
                {
                    switch (pattern.GetCell(x, y))
                    {
                    case 'X': lZobristHash.Delta(color.IsBlack ? Color.Black : Color.White, CoordinateSystem.At(x, y, lSize)); break;

                    case 'O': lZobristHash.Delta(color.IsBlack ? Color.White : Color.Black, CoordinateSystem.At(x, y, lSize)); break;
                    }
                }
            }

            return(lZobristHash);
        }
Exemplo n.º 3
0
        public static string ToDFA(Pattern pattern, int transform)
        {
            StringBuilder lDFA    = new StringBuilder(200);
            Coordinate    lSpiral = new Coordinate(0, 0);

            int lArea = pattern.Width * pattern.Height;

            while (lArea > 0)
            {
                Coordinate p = pattern.Origin + lSpiral.Transform(transform);
                lSpiral.SpiralNext();

                lDFA.Append(Pattern.ToStandard(pattern.GetCell(p)));

                if (pattern.IsInPattern(p))
                {
                    lArea--;
                }
            }

            return(lDFA.ToString().TrimEnd('$'));
        }
Exemplo n.º 4
0
        public static string ToDFA(Pattern pattern, int transform)
        {
            StringBuilder lDFA = new StringBuilder(200);
            Coordinate lSpiral = new Coordinate(0, 0);

            int lArea = pattern.Width * pattern.Height;

            while (lArea > 0)
            {
                Coordinate p = pattern.Origin + lSpiral.Transform(transform);
                lSpiral.SpiralNext();

                lDFA.Append(Pattern.ToStandard(pattern.GetCell(p)));

                if (pattern.IsInPattern(p))
                    lArea--;
            }

            return lDFA.ToString().TrimEnd('$');
        }