コード例 #1
0
ファイル: Rook.cs プロジェクト: starrett67/Chess
        public Rook(bool isWhite, Board board)
        {
            ChessBoard = board;
            Team = isWhite;
            InPlay = true;

            if (isWhite)
            {
                if (ChessBoard.GetCountOfType(this.GetType(), Team) < 1)
                {
                    Position = new Pair(0, 0);
                }
                else if (ChessBoard.GetCountOfType(this.GetType(), Team) < 2)
                    Position = new Pair(0, 7);
            }
            else
            {
                if (ChessBoard.GetCountOfType(this.GetType(), Team) < 1)
                {
                    Position = new Pair(7, 0);
                }
                else if (ChessBoard.GetCountOfType(this.GetType(), Team) < 2)
                    Position = new Pair(7, 7);
            }
        }
コード例 #2
0
ファイル: Bishop.cs プロジェクト: starrett67/Chess
        public Bishop(bool isWhite, Board board)
        {
            ChessBoard = board;
            Team = isWhite;
            InPlay = true;

            if (isWhite)
            {
                if (ChessBoard.GetCountOfType(this.GetType(), Team) == 0)
                {
                    Position = new Pair(0, 2);
                }
                else if (ChessBoard.GetCountOfType(this.GetType(), Team) == 1)
                    Position = new Pair(0, 5);
            }
            else
            {
                if (ChessBoard.GetCountOfType(this.GetType(), Team) == 0)
                {
                    Position = new Pair(7, 2);
                }
                else if (ChessBoard.GetCountOfType(this.GetType(), Team) == 1)
                    Position = new Pair(7, 5);
            }
        }
コード例 #3
0
ファイル: Knight.cs プロジェクト: starrett67/Chess
        public Knight(bool isWhite, Board board)
        {
            ChessBoard = board;
            Team = isWhite;
            InPlay = true;

            if (isWhite)
            {
                if (ChessBoard.GetCountOfType(this.GetType(), Team) == 0)
                {
                    Position = new Pair(0, 1);
                }
                else
                    Position = new Pair(0, 6);
            }
            else
            {
                if (ChessBoard.GetCountOfType(this.GetType(), Team) == 0)
                {
                    Position = new Pair(7, 1);
                }
                else
                    Position = new Pair(7, 6);
            }
        }
コード例 #4
0
ファイル: Pawn.cs プロジェクト: starrett67/Chess
        public Pawn(bool isWhite, Board board)
        {
            ChessBoard = board;
            InPlay = true;
            Team = isWhite;
            if (isWhite)
            {
                int PawnsAlreadyOnBoard = ChessBoard.GetCountOfType(this.GetType(), Team);
                Position = new Pair(WhiteVerticalStart, PawnsAlreadyOnBoard);
            }

            else
            {
                int PawnsAlreadyOnBoard = ChessBoard.GetCountOfType(this.GetType(), Team);
                Position = new Pair(BlackVerticalStart, PawnsAlreadyOnBoard);
            }
        }