private void CheckCommand(object sender, EventArgs e)
        {
            MyMasterMindCodeColors[] code = new MyMasterMindCodeColors[MyMasterMindConstants.Columns];

            int currentGuessRow = Game.GetCurrentGuessRow() + 1;

            for (int i = 0; i < MyMasterMindConstants.Columns; i++)
            {
                code[i] = MasterMindBoard.GetGuessColor(currentGuessRow, i);
            }

            IMasterMindGuessModel guess = Game.SetGuess(currentGuessRow, code);

            MasterMindBoard.SetGuessEvaluation(currentGuessRow, guess.GetEvaluation().Black, guess.GetEvaluation().White);

            MasterMindBoard.MarkGuessCell(currentGuessRow, CellMark.None);
            currentGuessRow++;
            if ((currentGuessRow >= MyMasterMindConstants.Rows) || Game.Finished())
            {
                ShowCode();
                DisableCommands(new List <MyMasterMindCommands>()
                {
                    MyMasterMindCommands.Check, MyMasterMindCommands.Cancel
                });
                EnableCommands(new List <MyMasterMindCommands>()
                {
                    MyMasterMindCommands.ComputerSlow, MyMasterMindCommands.ComputerFast, MyMasterMindCommands.User, MyMasterMindCommands.Clear
                });
                return;
            }
            MasterMindBoard.MarkGuessCell(currentGuessRow, CellMark.ForInput);

            MasterMindCommands.SetButtonState(MyMasterMindCommands.Check, false);
        }
Exemplo n.º 2
0
        public static Brush GetCodeBrush(MyMasterMindCodeColors color)
        {
            if (_singleton == null)
            {
                _singleton = new DisplayColors();
            }

            return(_singleton.CodeBrushes[(int)color]);
        }
        private void CheckCheckCommand(object sender, EventArgs e)
        {
            bool state = UserPlaying;

            MyMasterMindCodeColors[] code = new MyMasterMindCodeColors[MyMasterMindConstants.Columns];

            if (Game != null)
            {
                int currentGuessRow = Game.GetCurrentGuessRow() + 1;
                for (int i = 0; i < MyMasterMindConstants.Columns; i++)
                {
                    code[i] = MasterMindBoard.GetGuessColor(currentGuessRow, i);
                }

                state = state && (code.All(c => c != MyMasterMindCodeColors.None));
            }

            MasterMindCommands.SetButtonState(MyMasterMindCommands.Check, state);
        }
 public void SetGuessColor(int row, int column, MyMasterMindCodeColors color)
 {
     GuessCells[row].SetColor(column, color);
 }
 public void SetCodeColor(int column, MyMasterMindCodeColors color)
 {
     Code.SetColor(column, color);
 }
Exemplo n.º 6
0
 internal void SetColor(int column, MyMasterMindCodeColors color)
 {
     Field[column].SetColor(color);
 }