Пример #1
0
        private void radLabel2_Click(object sender, EventArgs e)
        {
            if (StratigyAlgorithm.SelectedItem == null)
            {
                StratigyAlgorithm.Select();  return;
            }
            if (FirstPlayer.SelectedItem == null)
            {
                FirstPlayer.Select(); return;
            }
            Game.DifficultyLevel level = beginner.IsChecked
                ? Game.DifficultyLevel.Easy
                : medium.IsChecked
                    ? Game.DifficultyLevel.Meduim
                    : Game.DifficultyLevel.Difficult;

            IntelligentAgent agent = StratigyAlgorithm.SelectedItem.Index == 0 ? new IntelligentAgent(level) : new IntelligentAgent(level, true);
            int player             = FirstPlayer.SelectedItem.Index == 0 ? 1 : 2;

            //_game = new Game(level) {NextPlayer = player, Agent = agent};
            //_game = new Game(agent, level,Cell.IntCount) {NextPlayer = player, Agent = agent };
            _game = new Game(level, Cell.IntCount)
            {
                NextPlayer = player, Agent = agent
            };
            _game.Subscribe(this);
            Informant.Text = FirstPlayer.SelectedItem.Index == 0 ? "Computer's Turn" : "Your Turn";
            Curten.Start();
        }
        public IntelligentAgent(Game.DifficultyLevel level = Game.DifficultyLevel.Meduim, bool alphaBeta = false)
        {
            AlphaBeta = alphaBeta;
            switch (level)
            {
            case Game.DifficultyLevel.Easy:
                Lookahead = 1;
                break;

            case Game.DifficultyLevel.Difficult:
                Lookahead = 3;
                break;

            default:
                Lookahead = 4;
                break;
            }
        }