Пример #1
0
    public void FactsTestSimplePasses()
    {
        Facts facts = new Facts();

        facts.Init("Assets/facts.txt");
        facts.FindValid(new List <string> {
            "ZEITUNG", "AUTOR", "ORT", "REGION"
        }, new Dictionary <string, string> {
        });

        Assert.AreEqual(1, 1);
    }
Пример #2
0
    public News GetNextNews(int compexity)
    {
        Dictionary <string, string> solution = null;
        HeadlineInfoEn info = null;

        while (solution == null)
        {
            info = News[idx];
            idx  = (idx + 1) % News.Count;
            List <string> findCats = null;
            switch (compexity)
            {
            case 0:
            {
                findCats = simpleCats[rng.Next() % simpleCats.Count];
            }
            break;

            case 1:
            {
                findCats = mediumCats[rng.Next() % mediumCats.Count];
            }
            break;

            case 2:
            {
                findCats = hardCats[rng.Next() % hardCats.Count];
            }
            break;

            default:
            {
                findCats = hardCats[rng.Next() % hardCats.Count];
            }
            break;
            }
            var constr = new Dictionary <string, string> {
                { "EVENT", info.eventCode }, { "FACHGEBIET", info.topicCode }
            };
            solution = info.isReal ? facts.FindValid(findCats, constr) : facts.FindInvalid(findCats, constr);
            if (solution == null)
            {
                Console.WriteLine("COULD FIND NO SOLUTION FOR '{0}'", info.headline);
            }
        }
        progression += 1;
        string author = null;

        solution.TryGetValue("AUTOR", out author);
        string newspaper = null;

        solution.TryGetValue("ZEITUNG", out newspaper);
        string date = null;

        solution.TryGetValue("DATE", out date);
        string day = null;

        solution.TryGetValue("TAG", out day);
        string location = null;

        solution.TryGetValue("ORT", out location);
        string error = null;

        solution.TryGetValue("ERROR", out error);
        return(info.toNews(author, newspaper, date != null ? GetNextWeekday(date, day).ToString("dd.MM.yyyy") : null, location, error));
    }