コード例 #1
0
        public Piece[,] init(char p1Color, char p2Color)
        {
            Console.OutputEncoding = Encoding.Unicode;
            Piece[,] board         = new Piece[8, 8];
            board[0, 0]            = new Rook(p2Color);
            board[1, 0]            = new Knight(p2Color);
            board[2, 0]            = new Bishop(p2Color);
            board[5, 0]            = new Bishop(p2Color);
            board[6, 0]            = new Knight(p2Color);
            board[7, 0]            = new Rook(p2Color);
            if (p2Color == 'w')
            {
                board[3, 0] = new King(p2Color);
                board[4, 0] = new Queen(p2Color);
            }
            else
            {
                board[4, 0] = new King(p2Color);
                board[3, 0] = new Queen(p2Color);
            }
            for (int i = 0; i < 8; i++)
            {
                board[i, 1] = new Pawn(p2Color);
            }


            board[0, 7] = new Rook(p1Color);
            board[1, 7] = new Knight(p1Color);
            board[2, 7] = new Bishop(p1Color);
            board[5, 7] = new Bishop(p1Color);
            board[6, 7] = new Knight(p1Color);
            board[7, 7] = new Rook(p1Color);
            if (p1Color == 'w')
            {
                board[4, 7] = new King(p1Color);
                board[3, 7] = new Queen(p1Color);
            }
            else
            {
                board[3, 7] = new King(p1Color);
                board[4, 7] = new Queen(p1Color);
            }
            for (int i = 0; i < 8; i++)
            {
                board[i, 6] = new Pawn(p1Color);
            }
            return(board);
        }
コード例 #2
0
        public static Game SetUp()
        {
            var board = new BasePiece[8, 8];

            board[0, 1] = new Knight()
            {
                Color = Color.White, Location = new Vector(0, 1)
            };
            board[0, 6] = new Knight()
            {
                Color = Color.White, Location = new Vector(0, 6)
            };
            board[7, 1] = new Knight()
            {
                Color = Color.Black, Location = new Vector(7, 1)
            };
            board[7, 6] = new Knight()
            {
                Color = Color.Black, Location = new Vector(7, 6)
            };

            board[0, 2] = new Bishop()
            {
                Color = Color.White, Location = new Vector(0, 2)
            };
            board[0, 5] = new Bishop()
            {
                Color = Color.White, Location = new Vector(0, 5)
            };
            board[7, 2] = new Bishop()
            {
                Color = Color.Black, Location = new Vector(7, 2)
            };
            board[7, 5] = new Bishop()
            {
                Color = Color.Black, Location = new Vector(7, 5)
            };

            board[0, 0] = new Rook()
            {
                Color = Color.White, Location = new Vector(0, 0)
            };
            board[0, 7] = new Rook()
            {
                Color = Color.White, Location = new Vector(0, 7)
            };
            board[7, 0] = new Rook()
            {
                Color = Color.Black, Location = new Vector(7, 0)
            };
            board[7, 7] = new Rook()
            {
                Color = Color.Black, Location = new Vector(7, 7)
            };

            board[0, 4] = new King()
            {
                Color = Color.White, Location = new Vector(0, 4)
            };
            board[0, 3] = new BombAssassin()
            {
                Color = Color.White, Location = new Vector(0, 3)
            };
            board[7, 4] = new King()
            {
                Color = Color.Black, Location = new Vector(7, 4)
            };
            board[7, 3] = new BombAssassin()
            {
                Color = Color.Black, Location = new Vector(7, 3)
            };

            for (int i = 0; i < 8; i++)
            {
                board[1, i] = new Pawn()
                {
                    Color = Color.White, Location = new Vector(1, i)
                };
                board[6, i] = new Pawn()
                {
                    Color = Color.Black, Location = new Vector(6, i)
                };
            }

            Game Game = new Game();

            Game.History.Push(board);
            Game.Players.Enqueue(new BasePlayer()
            {
                Name = "player1", Color = Color.White
            });
            Game.Players.Enqueue(new Murderer()
            {
                Name = "player2", Color = Color.Black
            });

            return(Game);
        }
コード例 #3
0
        public static Game SetUp()
        {
            var board = new BasePiece[8, 8];

            board[0, 1] = new Knight()
            {
                Color = Color.White, Location = new Vector(0, 1)
            };
            board[0, 6] = new Knight()
            {
                Color = Color.White, Location = new Vector(0, 6)
            };
            board[7, 1] = new Knight()
            {
                Color = Color.Black, Location = new Vector(7, 1)
            };
            board[7, 6] = new Knight()
            {
                Color = Color.Black, Location = new Vector(7, 6)
            };

            board[0, 2] = new Bishop()
            {
                Color = Color.White, Location = new Vector(0, 2)
            };
            board[0, 5] = new Bishop()
            {
                Color = Color.White, Location = new Vector(0, 5)
            };
            board[7, 2] = new Bishop()
            {
                Color = Color.Black, Location = new Vector(7, 2)
            };
            board[7, 5] = new Bishop()
            {
                Color = Color.Black, Location = new Vector(7, 5)
            };

            board[0, 0] = new Rook()
            {
                Color = Color.White, Location = new Vector(0, 0)
            };
            board[0, 7] = new Rook()
            {
                Color = Color.White, Location = new Vector(0, 7)
            };
            board[7, 0] = new Rook()
            {
                Color = Color.Black, Location = new Vector(7, 0)
            };
            board[7, 7] = new Rook()
            {
                Color = Color.Black, Location = new Vector(7, 7)
            };

            board[0, 4] = new King()
            {
                Color = Color.White, Location = new Vector(0, 4)
            };

            board[7, 4] = new King()
            {
                Color = Color.Black, Location = new Vector(7, 4)
            };

            board[0, 3] = new Squart()
            {
                Color = Color.White, Location = new Vector(0, 3)
            };
            board[7, 3] = new Squart()
            {
                Color = Color.Black, Location = new Vector(7, 3)
            };

            for (int i = 0; i < 8; i++)
            {
                board[1, i] = new Pawn()
                {
                    Color = Color.White, Location = new Vector(1, i)
                };
                board[6, i] = new Pawn()
                {
                    Color = Color.Black, Location = new Vector(6, i)
                };
            }

            Game Game = new Game();

            Game.History.Push(board);

            //makes the players
            comandRunner.createPlayers(Game);

            return(Game);
        }
コード例 #4
0
        public Game SetUp()
        {
            var board = new Piece[8, 8];

            board[0, 1] = new Knight()
            {
                Color = Color.White, Location = new Vector(0, 1)
            };
            board[0, 6] = new Knight()
            {
                Color = Color.White, Location = new Vector(0, 6)
            };
            board[7, 1] = new Knight()
            {
                Color = Color.Black, Location = new Vector(7, 1)
            };
            board[7, 6] = new Knight()
            {
                Color = Color.Black, Location = new Vector(7, 6)
            };

            board[0, 2] = new Bishop()
            {
                Color = Color.White, Location = new Vector(0, 2)
            };
            board[0, 5] = new Bishop()
            {
                Color = Color.White, Location = new Vector(0, 5)
            };
            board[7, 2] = new Bishop()
            {
                Color = Color.Black, Location = new Vector(7, 2)
            };
            board[7, 5] = new Bishop()
            {
                Color = Color.Black, Location = new Vector(7, 5)
            };

            board[0, 0] = new Rook()
            {
                Color = Color.White, Location = new Vector(0, 0)
            };
            board[0, 7] = new Rook()
            {
                Color = Color.White, Location = new Vector(0, 7)
            };
            board[7, 0] = new Rook()
            {
                Color = Color.Black, Location = new Vector(7, 0)
            };
            board[7, 7] = new Rook()
            {
                Color = Color.Black, Location = new Vector(7, 7)
            };


            board[0, 4] = new King()
            {
                Color = Color.White, Location = new Vector(0, 4)
            };
            //board[0, 3] = new Queen() { Color = Color.White, Location = new Vector(0, 3) };
            board[7, 4] = new King()
            {
                Color = Color.Black, Location = new Vector(7, 4)
            };
            //board[7, 3] = new Queen() { Color = Color.black, Location = new Vector(7, 3) };



            for (int i = 0; i < 8; i++)
            {
                board[1, i] = new Pawn()
                {
                    Color = Color.White, Location = new Vector(1, i)
                };
                board[6, i] = new Pawn()
                {
                    Color = Color.Black, Location = new Vector(6, i)
                };
            }

            Game Game = new Game()
            {
                History = new System.Collections.Generic.Stack <Piece[, ]>()
            };

            Game.History.Push(board);

            return(Game);
        }