Exemplo n.º 1
0
 public Board(string[] gridLines)
 {
     _cursor        = new Cursor(Board.GridLength);
     _grid          = GridBuilder.CreateGrid(gridLines);
     PieceSelection = NullPieceSelection.GetInstance();
     _view          = new BoardView(this);
     IsFlipped      = false;
 }
Exemplo n.º 2
0
 private Board(Piece[,] grid)
 {
     _cursor        = new Cursor(Board.GridLength);
     _grid          = GridBuilder.CloneGrid(grid);
     PieceSelection = NullPieceSelection.GetInstance();
     _view          = new BoardView(this);
     IsFlipped      = false;
 }
Exemplo n.º 3
0
        private void _selectCursorPiece(PieceColor currentPlayer)
        {
            var coordinates          = _cursor.getCoordinates();
            var piece                = _grid[coordinates.Item1, coordinates.Item2];
            var isCurrentPlayerPiece = piece.Color == currentPlayer;

            if (isCurrentPlayerPiece)
            {
                var validMoveOptions = _filterValidMoves(piece);
                PieceSelection = new PieceSelection(piece, validMoveOptions);
            }
            else
            {
                PieceSelection = NullPieceSelection.GetInstance();
            }
        }