Пример #1
0
        /// <summary>
        /// AI plays a move
        /// </summary>
        public async void PlayAsAI()
        {
            if (CanPlay())
            {
                string word = WordProcessor.GetWord(StartLetter);
                StartLetter = word.LastLetter();

                if (StartLetter == "ğ")
                {
                    StartLetter = "g";
                }


                lastLetterForPlace = word.LastLetter();
                AIWords.Add(new ListModel(word));
                BaloonSound();
                DeletePreviousWords();

                AIScore += word.Length * 1;
            }
            else
            {
                await PopupNavigation.Instance.PushAsync(new FinishPopup(GameState.Win));
            }
        }
Пример #2
0
        /// <summary>
        /// Player plays a move
        /// </summary>
        /// <param name="word"></param>
        public bool PlayAsPlayer(string word)
        {
            if (CanPlay())
            {
                bool valid = WordProcessor.IsValid(word, StartLetter);

                if (valid)
                {
                    StartLetter = word.LastLetter();

                    if (StartLetter == "ğ")
                    {
                        StartLetter = "g";
                    }

                    PlayerWords.Add(new ListModel(word));

                    DeletePreviousWords();

                    PlayerScore += word.Length * 1;
                }

                PlayAsAI();

                return(valid);
            }
            else
            {
                PopupNavigation.Instance.PushAsync(new FinishPopup(GameState.Lose));
            }

            return(false);
        }
Пример #3
0
        /// <summary>
        /// AI plays the first move
        /// </summary>
        public void Start()
        {
            string word = WordProcessor.GetWord();

            StartLetter = word.LastLetter();
            AIWords.Add(new ListModel(word));
            BaloonSound();
        }