Example #1
0
        public int LettersLeft()
        {
            var left = 0;

            for (var i = 1; i < Word.Length - 1; ++i)
            {
                if (!Tried.Contains(Word[i]))
                {
                    ++left;
                }
            }
            return(left);
        }
Example #2
0
        public int LettersAndSpacesLeft()
        {
            int left   = 0;
            int spaces = Word.Count(Char.IsWhiteSpace);

            for (int i = 0; i < Word.Length; ++i)
            {
                if (!Tried.Contains(Word[i]))
                {
                    left++;
                }
            }
            return(left - spaces);
        }
Example #3
0
        public void UpdateCurrentState()
        {
            var currentState = new StringBuilder();

            for (var i = 0; i <= Word.Length - 1; i++)
            {
                if (Tried.Contains(Word[i]))
                {
                    currentState.Append($" {Word[i]} ");
                }
                else
                {
                    currentState.Append(" _ ");
                }
            }
            CurrentState = currentState.ToString();
        }
Example #4
0
        public void UpdateCurrentState()
        {
            var currentState = new StringBuilder();

            currentState.Append($"{Word[0]} ");
            for (var i = 1; i < Word.Length - 1; ++i)
            {
                if (Tried.Contains(Word[i]))
                {
                    currentState.Append($"{Word[i]} ");
                }
                else
                {
                    currentState.Append("_ ");
                }
            }
            currentState.Append(Word[Word.Length - 1]);
            this.CurrentState = currentState.ToString();
        }