Ejemplo n.º 1
0
        public static Suduku GetNextRandom(this Suduku current, bool HoldPointer = false)
        {
            Random rand = new Random((int)DateTime.Now.Ticks);
            var    x    = rand.Next(0, (int)current.SudukuType);
            var    y1   = rand.Next(0, (int)current.SudukuType);
            var    y2   = y1;

            while (y2 == y1)
            {
                y2 = rand.Next(0, (int)current.SudukuType);
            }

            var next = current.Swap(x, y1, x, y2, HoldPointer);

            return(next);
        }
Ejemplo n.º 2
0
        private Suduku Next(Suduku su, double t)
        {
            var x  = rand.Next(0, (int)su.SudukuType);
            var y1 = rand.Next(0, (int)su.SudukuType);
            var y2 = y1;

            while (y2 == y1)
            {
                y2 = rand.Next(0, (int)su.SudukuType);
            }

            var next = su.Swap(x, y1, x, y2, false);

            if (dic.ContainsKey(next.GetHashCode()))
            {
                return(Next(su, t));
            }
            else
            {
                return(next);
            }
        }