Beispiel #1
0
        internal void ChangeSmallerButtonsAccordingToTheScore(sScorePerGuess i_score)
        {
            int indexToChange = 0;

            for (int i = 0; i < i_score.m_bul; i++)
            {
                m_userSelectionButtons[indexToChange].BackColor = Color.Black;
                indexToChange++;
            }

            for (int i = 0; i < i_score.m_hit; i++)
            {
                m_userSelectionButtons[indexToChange].BackColor = Color.Yellow;
                indexToChange++;
            }
        }
Beispiel #2
0
        private void ConfirmSelectionButton_Click(object sender, EventArgs e)
        {
            int            indexOfBlock          = int.Parse((sender as Button).Name);
            List <Button>  buttonsToCheck        = m_blockCollection[indexOfBlock].PickColorButtons; /// the buttons of the same block
            List <int>     intColorsOfTHeButtons = ConvertColorsOfTheButtonsToInt(buttonsToCheck);
            sScorePerGuess score = m_gameObject.AnalyzeScore(intColorsOfTHeButtons);

            m_blockCollection[indexOfBlock].ChangeSmallerButtonsAccordingToTheScore(score);
            (sender as Button).Enabled = false;

            foreach (Button btn in buttonsToCheck)
            {
                btn.Enabled = false;
            }

            if (score.m_bul == 4)
            {
                RevieleComputerGuess();
            }
            this.EnableBlock(indexOfBlock + 1);
        }
Beispiel #3
0
        public sScorePerGuess AnalyzeScore(List <int> i_intColorsOfTheButton)
        {
            ushort o_numOfV = 0;
            ushort o_numOfX = 0;

            for (int i = 0; i < k_numOfLetters; i++)
            {
                ///exact match
                if (i_intColorsOfTheButton[i] == m_computerGuess[i])
                {
                    o_numOfV++;
                }
                else if (m_computerGuess.Contains(i_intColorsOfTheButton[i]))
                {
                    o_numOfX++;
                }
            }

            sScorePerGuess newScore = new sScorePerGuess(o_numOfV, o_numOfX);

            return(newScore);
        }