Example #1
0
 /// <summary>
 /// Generates a new puzzle and returns its board.
 /// </summary>
 /// <returns>The generated and setup board along with the solution.</returns>
 public static GameBoardLogic LoadRandomPuzzle()
 {
     Generator gen = new Generator();
     Random rand = new Random();
     int r = rand.Next(28, 34);
     //Logic.PopupManager.ShowWaitPopup("Generating puzzle with " + r + " clues.");
     string result = gen.GeneratePuzzleMultithreaded(r, 500);
     
     return FillNewPuzzle(result);
 }
Example #2
0
        private void Produce()
        {
            Generator gen = new Generator();
            string candidate = "";
            threadsOn = true;

            while (threadsOn)
            {
                if (candidate == "")
                {
                    gen.TryGeneratePuzzle(ClueNumer);
                    candidate = gen.ToString();
                }
                Monitor.Enter(candidateList);
                if (candidateList.Count < 20)
                {
                    candidateList.Add(candidate);

                    Monitor.Exit(candidateList);
                    candidate = "";
                }
                else
                {
                    Monitor.Exit(candidateList);
                    Thread.Sleep(50);
                }

            }
        }