Beispiel #1
0
        public void giveAnPeasant(PlayingPiece[,] board)
        {
            for (int i = -1; i <= 1; i += 2)
            {
                int[] sidePos = new int[2] {
                    pos [0] + i, pos [1]
                };
                SquareStatus temp = getSquareState(board, sidePos);
                if (temp != SquareStatus.occupied)
                {
                    continue;
                }

                PlayingPiece p = board[sidePos[0], sidePos[1]];
                if (p.type != PieceType.pawn || p.getColor() == playerColor)
                {
                    continue;
                }

                (p as Pawn).enableEnPeasant(this);
            }
        }
Beispiel #2
0
        private void initPlayerLists()
        {
            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 8; y++)
                {
                    PlayingPiece p = board [x, y];
                    if (p == null)
                    {
                        continue;
                    }

                    if (p.getColor() == Color.white)
                    {
                        whites.Add(p);
                    }
                    else
                    {
                        blacks.Add(p);
                    }
                }
            }
        }