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);
    }
Exemple #2
0
    public void LoadAlphabets()
    {
        // Load the Alphabet
        Alphabet alphabet = Alphabets.Load("en-us");

        Assert.Equal(26, alphabet.letters.Count);
    }
Exemple #3
0
    void TestBoardRandomizer()
    {
        string    debug;
        GameBoard board = null;

        board = BoardRandomizer.GenerateRandom(4, Alphabets.Load("en-us"));
        Assert.Equal(4, board.Size);
        debug = board.ToString();
    }