Пример #1
0
        private CrozzleGrid Recursive(CrozzleGrid aGrid, WordListTaskTwo wordList)
        {
            while (aTimer.Enabled == true)
            {
                if (aGrid.GetWordlistCount() == 0)
                {
                    return(aGrid);
                }
                if (aGrid.GetRootWord() == "")
                {
                    aGrid.AddRootWord();
                    aGrid.AddWordToGrid();
                }
                else
                {
                    aGrid.AddWordToGrid();
                }
                if (aGrid.GetCounter() == 0)
                {
                    ListOfGrids.Add(aGrid); //not copying the obj, everytime it adds a new grid it overides the reference in the list
                    WordListTaskTwo freshWordlist = new WordListTaskTwo(wordList);
                    CrozzleGrid     bGrid         = new CrozzleGrid(aGrid, freshWordlist);

                    return(Recursive(bGrid, freshWordlist));
                }

                return(Recursive(aGrid, wordList));
            }

            return(aGrid);
        }
Пример #2
0
 public CrozzleGrid(CrozzleGrid copy, WordListTaskTwo wordCopy)
 {
     this.Config                    = copy.Config;
     this.WordList                  = wordCopy; //this needs to be a fresh wordlist minus the rootword in the previous grids
     this.RowsAndColumns            = copy.RowsAndColumns;
     this.Grid                      = CreateGrid();
     this.Score                     = GetScore();
     this.LetterCordsForWordsInGrid = new CordsWordTable();
     this.RootWord                  = "";
     this.WordsInGrid               = new List <string>();
     this.WordsInserted             = new List <LastWordEntered>();
     this.WordsInsertedInGrid       = new List <Word>();
     this.index                     = 0;
     this.Counter                   = 0;
     this.WordListInUse             = WordList.Table;
     this.PreviousRootWords         = copy.PreviousRootWords;
     this.NamesList                 = new List <string>();
 }
Пример #3
0
 public CrozzleGrid(Configuration config, WordListTaskTwo wordlist, CrozzleTaskTwo rowsandcolumns)
 {
     Config                    = config;
     WordList                  = wordlist;
     RowsAndColumns            = rowsandcolumns;
     Grid                      = CreateGrid();
     Score                     = GetScore();
     LetterCordsForWordsInGrid = new CordsWordTable();
     RootWord                  = "";
     PreviousRootWords         = new List <string>();
     WordsInGrid               = new List <string>();
     WordsInserted             = new List <LastWordEntered>();
     WordsInsertedInGrid       = new List <Word>();
     index                     = 0;
     Counter                   = 0;
     WordListInUse             = WordList.Table;
     NamesList                 = new List <string>();
 }
Пример #4
0
 public WordListTaskTwo(WordListTaskTwo copy)
 {
     this.URL = copy.URL;
     PopulateTable();
 }
Пример #5
0
        private void OpenCrozzleAss2()
        {
            aTimer.Enabled = true;



            CrozzleTaskTwo config = new CrozzleTaskTwo(URLs.Task2Crozzle);
            // string configurationFileName = GetConfigurationFileName(URLs.Task2Crozzle);

            //validate configuration file.
            Configuration aConfiguration = null;

            Configuration.TryParseTaskTwo(config.ConfigurationURL, out aConfiguration);

            // Parse wordlist file.
            WordListTaskTwo wordList = new WordListTaskTwo(config.WordlistURL);

            //WordList.TryParseTaskTwo(config.WordlistURL, aConfiguration, out wordList);

            //char[,] grid = new char[Convert.ToInt16(config.Rows), Convert.ToInt16(config.Columns)];

            CrozzleGrid aGrid = new CrozzleGrid(aConfiguration, wordList, config);

            aGrid.AddRootWord();
            //aGrid.AddFirstWord();

            //Tree aTree = new Tree(aGrid);
            //aGrid.AddNameToGrid();

            //while (aTimer.Enabled = true || aGrid.GetWordlistCount() > 0)
            //{

            //}

            Recursive(aGrid, wordList);


            //aGrid.AddWordToGrid();
            //aTree.Add(aGrid);
            //aGrid.AddWordToGrid();
            //aGrid.AddWordToGrid();
            //aGrid.AddWordToGrid();
            //aGrid.AddWordToGrid();



            //ListOfGrids.Sort((x, y) => x.Score.CompareTo(y.OrderDate));

            //ListOfGrids.Sort()


            var maxObject = ListOfGrids.OrderByDescending(item => item.Score).First();

            string res = aGrid.DisplayGrid(maxObject);

            //string res = aGrid.CreateGrid();

            crozzleWebBrowser.DocumentText = res;

            //string res = aGrid.DisplayGrid(aGrid);
            ////string res = aGrid.CreateGrid();

            //crozzleWebBrowser.DocumentText = res;
        }