Beispiel #1
0
        private static void CheckTopBestWordScores(WordScoreItem wsi)
        {
            int indx = BestWordScores.FindIndex(f => (f.score < wsi.score));

            if (indx >= 0)
            {
                BestWordScores.Insert(indx, wsi);
            }
            else
            {
                BestWordScores.Add(wsi);
            }
            if (BestWordScores.Count > NumberOfTopScores)
            {
                BestWordScores.RemoveAt(NumberOfTopScores);
            }
        }
Beispiel #2
0
        private static void CheckTopLongestWordScores(WordScoreItem wsi)
        {
            int indx = LongestWords.FindIndex(f => (f.word.Length < wsi.word.Length));

            if (indx >= 0)
            {
                LongestWords.Insert(indx, wsi);
            }
            else
            {
                LongestWords.Add(wsi);
            }
            if (LongestWords.Count > NumberOfTopScores)
            {
                LongestWords.RemoveAt(NumberOfTopScores);
            }
        }
Beispiel #3
0
        private static void AddToTryList()
        {
            WordScoreItem wsi = new WordScoreItem()
            {
                word = GetCurrentWord(), score = ScoreWord(), wordscorestring = EngLetterScoring.GetWordTally(SelLetterList), simplescore = ScoreWordSimple()
            };
            int indx = TryWordList.FindIndex(f => (f.score < wsi.score));

            if (indx >= 0)
            {
                TryWordList.Insert(indx, wsi);
            }
            else
            {
                TryWordList.Add(wsi);
            }

            boardScript.ClearTryList();
            foreach (WordScoreItem wsi_I in TryWordList)
            {
                boardScript.AddTryList(wsi_I.word + " " + wsi_I.score.ToString());
                //TryList.Items.Add(wsi_I.word + " " + wsi_I.score.ToString());
            }
        }
Beispiel #4
0
        internal static ScoreStats RecordWordScore()
        {
            ScoreStats ss = new ScoreStats();

            int wordTotal = ScoreWord();

            //HistoryList.Items.Insert(0, GetWordTally());
            boardScript.AddHistory(GetCurrentWord() + " " + GetWordTally());

            totalScore += wordTotal;
            if (wordTotal > HighScoreWordValue)
            {
                HighScoreWordValue = wordTotal;
                HighScoreWord      = GetCurrentWord();
                HighScoreWordTally = EngLetterScoring.GetWordTally(SelLetterList);
            }

            WordScoreItem wsi = new WordScoreItem()
            {
                word = GetCurrentWord(), score = wordTotal, wordscorestring = EngLetterScoring.GetWordTally(SelLetterList), simplescore = ScoreWordSimple()
            };

            ss.bonus = EngLetterScoring.LengthBonus(wsi.word);

            FortuneWordScoreHistory.Add(wsi);
            if (FortuneWordScoreHistory.Count > EffWordCount)
            {
                FortuneWordScoreHistory.RemoveAt(0);
            }

            HistoryWords.Add(wsi);

            CheckTopBestWordScores(wsi);
            CheckTopBestWordScoresSimple(wsi);
            CheckTopLongestWordScores(wsi);

            totalwords++;

            TotalEfficiency = totalScore / totalwords;
            Efficiency      = GetLatestEff();

            if (GetFortune() == FortuneLevel.Great)
            {
                FortuneLevelCount++;
            }
            else
            {
                FortuneLevelCount = 0;
            }

            if (FortuneLevelCount > 4)
            {
                Manna += (FortuneLevelCount - 4);
            }
            ss.MannaScore = ScoreManna();

            // If it's a big or price word, give them a spell based on the word.
            string curword = GetCurrentWord();

            if (wordTotal > 14 || curword.Length >= 8)
            {
                SpellInfo si = null;

                if (wordTotal > 70 || curword.Length > 16)
                {
                    si = Spells.GetSpell(6, level);
                }
                else if (wordTotal > 55 || curword.Length > 15)
                {
                    si = Spells.GetSpell(5, level);
                }
                else if (wordTotal > 45 || curword.Length > 14)
                {
                    si = Spells.GetSpell(4, level);
                }
                else if (wordTotal > 35 || curword.Length > 13)
                {
                    si = Spells.GetSpell(3, level);
                }
                else if (wordTotal > 25 || curword.Length > 11)
                {
                    si = Spells.GetSpell(2, level);
                }
                else if (wordTotal > 17 || curword.Length > 9)
                {
                    si = Spells.GetSpell(1, level);
                }
                else if (wordTotal > 14 || curword.Length >= 8)
                {
                    si = Spells.GetSpell(0, level);
                }

                ss.si = si;
            }

            UpdateFortune();

            UpdateStats();

            return(ss);
        }