public void Setup()
 {
     _board = new CheckerBoard();
     _constants = new CheckersConstants();
     _strategy = new ComputerStrategy();
     ClearBoard();
 }
        public void DrawBoard(Graphics formGraphics, Size boardSize, CheckerBoard board)
        {
            SetImages();

            Image backBuffer = DrawToBuffer(board, boardSize);

            TransferDrawingToScreen(backBuffer, formGraphics);
        }
        public bool Move(CheckerBoard board, int checker)
        {
            bool moved = false;
            _board = board;
            _checkerColor = checker;

            moved = MakeJump();

            if (!moved)
            {
                moved = MakeNonJump();
            }

            return moved;
        }
        private void DrawCheckers(Graphics graphics, CheckerBoard board, Image blackCheckerImage, Image redCheckerImage)
        {
            for (int row = 0; row < _checkerConstants.SquaresInBoard; row++)
            {
                for (int column = 0; column < _checkerConstants.SquaresInBoard; column++)
                {
                    if(board.IsRedChecker(row, column))
                        DrawChecker(row, column, graphics, redCheckerImage);

                    if (board.IsBlackChecker(row, column))
                        DrawChecker(row, column, graphics, blackCheckerImage);

                    if(board.IsSquareSelected(row, column))
                        DrawSelectedSquare(row, column, graphics);
                }
            }
        }
 public void Setup()
 {
     _board = new CheckerBoard();
 }
        private Image DrawToBuffer(CheckerBoard board, Size boardSize)
        {
            //To allow doublebuffering
            var backbuffer = new Bitmap(boardSize.Width, boardSize.Height);

            using(Graphics graphicsBuffer = Graphics.FromImage(backbuffer))
            {
                DrawBoard(graphicsBuffer);
                DrawCheckers(graphicsBuffer, board, _blackCheckerImage, _redCheckerImage);
                graphicsBuffer.Dispose();
            }

            return backbuffer;
        }