Exemplo n.º 1
0
        private void makeGuessRowForTheGame(GuessRow guess, int i_indexOfTheRow, int i_indexOfFirstRow)
        {
            if (i_indexOfTheRow == i_indexOfFirstRow)
            {
                guess.SetEnableOfColorButtons(true);
            }

            else
            {
                guess.SetEnableOfColorButtons(false);
            }

            guess.AfterMakeGuess             += doWhenApplyButtonIsClicked;
            guess.AfterGuessColorButtonClick += setGuessButtonFromColorForm;
        }
Exemplo n.º 2
0
        private void doWhenApplyButtonIsClicked(string i_Guess, GuessRow io_GuessRow)
        {
            m_Game.PlayTurn(i_Guess);
            Game.eGuessResult[] resultOfTheCurrentTurn = m_Game.getLastGameResult();
            Game.eGameResult    gameResult             = m_Game.GameResult;
            io_GuessRow.interpretResult(resultOfTheCurrentTurn);

            if (gameResult.Equals(Game.eGameResult.Win))
            {
                finishGame(io_GuessRow.ColorButtons);
            }
            else if (gameResult.Equals(Game.eGameResult.StillPlaying))
            {
                m_GameRows[io_GuessRow.IndexOfRow + 1].SetEnableOfColorButtons(true);
            }

            io_GuessRow.SetEnableOfColorButtons(false);
        }
Exemplo n.º 3
0
        private void runGame()
        {
            const int k_IndexOfFirstRow = 0;
            const int k_RowLeft         = 12;
            const int k_GuessRowTop     = 80;
            const int k_SolutionRowTop  = 10;

            m_Game = new Game(m_SelectedNumberOfChances);
            SolutionRow solution = new SolutionRow(new Point(k_RowLeft, k_SolutionRowTop), 0);

            m_SolutionRow = solution;
            m_SolutionRow.SetEnableOfColorButtons(false);
            this.Controls.AddRange(solution.GetControls());
            for (int i = 0; i < m_SelectedNumberOfChances; i++)
            {
                GuessRow guess = new GuessRow(new Point(k_RowLeft, k_GuessRowTop), i);
                makeGuessRowForTheGame(guess, i, k_IndexOfFirstRow);
                m_GameRows.Add(guess);
                this.Controls.AddRange(guess.GetControls());
            }
        }