Exemple #1
0
        /// <summary>
        /// Iterates through all possible solutions that can be derived by running through the tree of children from the
        /// parent boards.
        /// </summary>
        /// <param name="incomplete"></param>
        /// <param name="gameSolutions"></param>
        public static void IterateSolutions(Dictionary <UInt32, GameBoardSolution> gameSolutions, Queue <UInt32> incomplete)
        {
            UInt32 current;

            while (incomplete.Count() != 0)
            {
                UInt32 previous = incomplete.Peek();
                incomplete.Dequeue();
                for (int row = 0; row < 5; row++)
                {
                    for (int col = 0; col < 5; col++)
                    {
                        current = Flip(previous, row, col);
                        if (!gameSolutions.ContainsKey(current))
                        {
                            displayBoard(current);
                            gameSolutions[current] = new GameBoardSolution(row, col, previous);
                            incomplete.Enqueue(current);
                        }
                        else
                        {
                            Console.WriteLine(".");
                        }
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Searches through the array for the Solution Path.
        /// </summary>
        /// <param name="gameSolutions"></param>
        /// <param name="search"></param>
        public void Find(Dictionary <UInt32, GameBoardSolution> gameSolutions, UInt32 search)
        {
            GameBoardSolution temp = gameSolutions[search];

            while (temp.previous != 0)
            {
                temp = gameSolutions[temp.previous];
            }
        }