Beispiel #1
0
        public Game(GuiController guiController)
        {
            gameboard = new Gameboard();
            gameLogic = new GameLogic(gameboard);

            // The evaluator class can be used to get a comparison regarding the win rate for several players

            /*evaluator = new Evaluator(this,
             *  new AlphaBetaPlayer(Player.White, 1, new Evaluation(Player.White, 1000, 1500, 50, 50, 0)),
             *  new AlphaBetaPlayer(Player.White, 1, new Evaluation(Player.White, 1000, 2000, 50, 50, 0)));*/
            evaluator = new Evaluator(this);

            this.guiController      = guiController;
            players                 = new AbstractPlayer[NUMBER_OF_PLAYERS];
            timerNextMove           = new Timer(PAUSE_BETWEEN_MOVES);
            timerNextMove.Elapsed  += timerNextMove_Elapsed;
            timerNextMove.AutoReset = false;
        }
Beispiel #2
0
        public Gui()
        {
            InitializeComponent();

            playButtons = new HexdameButton[61];
            int[] buttonsPerRow = new int[] { 1, 2, 3, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 3, 2, 1 };

            int index = 0;

            for (int i = 0; i < 9; i++)
            {
                int numberOfCells = 9 - Math.Abs(9 / 2 - i);

                for (int j = 0; j < numberOfCells; j++)
                {
                    HexdameButton button = new HexdameButton();

                    int number    = i + 1;
                    int character = j + 1;
                    if (i > 4)
                    {
                        character += i - 4;
                    }
                    button.FieldPosition = new Position(number, character);

                    button.Location = new Point(200 + (i > 4?250:(i + 1) * 50) - j * 50, 400 - 20 * (number + character - 2));
                    button.Width    = 50;
                    button.Height   = 20;

                    button.Click += button_Click;

                    playButtons[index] = button;
                    this.gamePanel.Controls.Add(button);
                    index++;
                }
            }

            buttonConfirmMove.Click += buttonConfirmMove_Click;

            controller = new GuiController(this);
        }