Пример #1
0
        private void SetPoint(int x, int y)
        {
            if (_game.MovesCounter == 1 && !_firstIsBot)
            {
                timerStart();
                humanBlack.SetPoint(7, 7);
            }
            else if (_isBlack && !_firstIsBot)
            {
                timerStart();
                humanBlack.SetPoint(x, y);
            }
            else if (_isBlack && _firstIsBot)
            {
                _point = new Point(0, 0);
            }
            else if (!_isBlack && !_secondIsBot)
            {
                timerStart();
                humanWhite.SetPoint(x, y);
            }
            else if (!_isBlack && _secondIsBot)
            {
                _point = new Point(0, 0);
            }

            timer.Start();
        }
Пример #2
0
        private void DoMove()
        {
            Player player = _isBlack ? blackPlayer : whitePlayer;
            string liter  = _isBlack ? "\nB" : "W";

            while (_game.State == run)
            {
                Point move = _point;

                move = player.MakeMove(_game.Board);
                if (_game.MakeMove(move))
                {
                    Image black = new Image();
                    SetStoneImage(black, move.X, move.Y);
                    moves.Text += $"{liter} ({move.X + 1}; {15 - move.Y}) ";
                    _isBlack    = !_isBlack;
                    break;
                }
                return;
            }
            if (_game.State == GameStates.BLACK_WON)
            {
                string msg = "Black player won!";
                ShowWinner(msg);
            }
            else if (_game.State == GameStates.WHITE_WON)
            {
                string msg = "White player won!";
                ShowWinner(msg);
            }
            else if (_game.State == GameStates.DRAW)
            {
                string msg = "Draw!";
                ShowWinner(msg);
            }
        }