예제 #1
0
    public void ExistingBoard()
    {
        GameBoard board = new GameBoard(new char[4, 4]
        {
            { 'y', 'o', 'x', 'f' },
            { 'y', 'o', 'x', 'u' },
            { 'r', 'b', 'a', 'n' },
            { 'v', 'e', 'd', 'd' }
        });

        // Load the Alphabet
        Alphabet alphabet = Alphabets.Load("en-us");

        // Load the Dictionary
        Dictionary dict = Dictionaries.Load("english-words");

        BoardSolution sol      = BoardConstructor.Solve(alphabet, dict, board);
        string        solboard = sol.SolvedBoard.ToString();
        int           words    = sol.SolutionWords.Count;

        Assert.InRange(words, 1, int.MaxValue);
        Assert.Equal(24, solboard.Length);
        Assert.Equal(4, sol.SolvedBoard.Size);
        Assert.Equal("en-us", sol.AlphabetId);
        Assert.Equal("english-words", sol.DictionaryId);
    }
예제 #2
0
파일: Program.cs 프로젝트: Makeea/WordsWar
        static void Main(string[] args)
        {
            BoardSolution sol = BoardConstructor.Build_Solve_Publish(4, "en-us", "english-words");

            Console.WriteLine(sol.ToString());
            string json = JsonConvert.SerializeObject(sol, Formatting.Indented);

            Console.WriteLine(json);
        }
예제 #3
0
    public void ConstructABoard()
    {
        BoardSolution sol      = null;
        string        solboard = "";
        int           words    = 0;

        sol      = BoardConstructor.Build_Solve(4, "en-us", "english-words");
        solboard = sol.SolvedBoard.ToString();
        words    = sol.SolutionWords.Count;

        Assert.InRange(words, 1, int.MaxValue);
        Assert.Equal(24, solboard.Length);
        Assert.Equal(4, sol.SolvedBoard.Size);
        Assert.Equal("en-us", sol.AlphabetId);
        Assert.Equal("english-words", sol.DictionaryId);
    }