void handlePlayButtonClick()
    {
        string wordPlayed = gameState.GetWordToPlay();

        if (wordPlayed.Length < 3)
        {
            return;
        }



        List <LetterTileModel> inPlayTiles = gameState.GetInPlayTiles();

        bool valid = SpellChecker.CheckWord(wordPlayed.ToLower());

        if (valid)
        {
            while (inPlayTiles.Count > 0)
            {
                KillTile(inPlayTiles[0]);
            }
        }
        else
        {
            while (inPlayTiles.Count > 0)
            {
                removeTileFromPlay(inPlayTiles[0]);
            }
        }

        gameState.ClearTilesInPlay();
    }
Beispiel #2
0
 public void WordIsCorrectIfInDictionaryIgnoreCase()
 {
     Assert.That(SpellChecker.CheckWord("абвгдеж", new string[] { "абвж", "АБВГдеж" }), Is.EqualTo("АБВГдеж"));
 }
Beispiel #3
0
 public void MoreThanOneCorrectionWithEditDistTwoAndChangedOrderInDict()
 {
     Assert.That(SpellChecker.CheckWord("Two", new string[] { "tewot", "van", "too", "three" }), Is.EqualTo("{tewot too}"));
 }
Beispiel #4
0
 public void MoreThanOneEditCorrection()
 {
     Assert.That(SpellChecker.CheckWord("Three", new string[] { "van", "Tree", "Threek", "Threk", "sthree" }), Is.EqualTo("{Tree Threek sthree}"));
 }
Beispiel #5
0
 public void OneEditCorrection()
 {
     Assert.That(SpellChecker.CheckWord("Abcde", new string[] { "van", "abcdef", "abcdf" }), Is.EqualTo("abcdef"));
 }
Beispiel #6
0
 public void NoCorrections()
 {
     Assert.That(SpellChecker.CheckWord("abcdefg", new string[] { "van", "abcdr" }), Is.EqualTo("{abcdefg?}"));
 }