コード例 #1
0
ファイル: ChessQueenTests.cs プロジェクト: raosong/Practices
        public void ChessQueen_NotExisting3_Test()
        {
            ChessQueen cq     = new ChessQueen();
            var        result = cq.PlaceQueen(3);

            result.Should().BeNull("Result should be null.");
        }
コード例 #2
0
ファイル: ChessQueenTests.cs プロジェクト: raosong/Practices
        public void ChessQueen_Existing1_Test()
        {
            ChessQueen cq     = new ChessQueen();
            var        result = cq.PlaceQueen(1);

            result.Should().NotBeNull("Result should not be null.");
            result[0].Should().Be(0, "Result[0] is incorrect.");
        }
コード例 #3
0
ファイル: ChessGame.cs プロジェクト: HendrikMennen/Dash2D
        public void reset()
        {
            chessfield = new ChessFigure[8, 8];

            for (int xa = 0; xa < chessfield.GetLength(0); xa++)
            {
                for (int ya = 0; ya < chessfield.GetLength(0); ya++)
                {
                    chessfield[xa, ya] = new ChessPlaceholder();
                }
            }

            //BLACK
            chessfield[0, 0] = new ChessTower(x, y, false, this);
            chessfield[1, 0] = new ChessHorse(x + 16, y, false, this);
            chessfield[2, 0] = new ChessRunner(x + 32, y, false, this);
            chessfield[3, 0] = new ChessQueen(x + 48, y, false, this);
            chessfield[4, 0] = new ChessKing(x + 64, y, false, this);
            chessfield[5, 0] = new ChessRunner(x + 80, y, false, this);
            chessfield[6, 0] = new ChessHorse(x + 96, y, false, this);
            chessfield[7, 0] = new ChessTower(x + 112, y, false, this);

            chessfield[0, 1] = new ChessFarmer(x, y + 16, false, this);
            chessfield[1, 1] = new ChessFarmer(x + 16, y + 16, false, this);
            chessfield[2, 1] = new ChessFarmer(x + 32, y + 16, false, this);
            chessfield[3, 1] = new ChessFarmer(x + 48, y + 16, false, this);
            chessfield[4, 1] = new ChessFarmer(x + 64, y + 16, false, this);
            chessfield[5, 1] = new ChessFarmer(x + 80, y + 16, false, this);
            chessfield[6, 1] = new ChessFarmer(x + 96, y + 16, false, this);
            chessfield[7, 1] = new ChessFarmer(x + 112, y + 16, false, this);

            //WHITE
            chessfield[0, 7] = new ChessTower(x, y + 112, true, this);
            chessfield[1, 7] = new ChessHorse(x + 16, y + 112, true, this);
            chessfield[2, 7] = new ChessRunner(x + 32, y + 112, true, this);
            chessfield[3, 7] = new ChessQueen(x + 48, y + 112, true, this);
            chessfield[4, 7] = new ChessKing(x + 64, y + 112, true, this);
            chessfield[5, 7] = new ChessRunner(x + 80, y + 112, true, this);
            chessfield[6, 7] = new ChessHorse(x + 96, y + 112, true, this);
            chessfield[7, 7] = new ChessTower(x + 112, y + 112, true, this);

            chessfield[0, 6] = new ChessFarmer(x, y + 96, true, this);
            chessfield[1, 6] = new ChessFarmer(x + 16, y + 96, true, this);
            chessfield[2, 6] = new ChessFarmer(x + 32, y + 96, true, this);
            chessfield[3, 6] = new ChessFarmer(x + 48, y + 96, true, this);
            chessfield[4, 6] = new ChessFarmer(x + 64, y + 96, true, this);
            chessfield[5, 6] = new ChessFarmer(x + 80, y + 96, true, this);
            chessfield[6, 6] = new ChessFarmer(x + 96, y + 96, true, this);
            chessfield[7, 6] = new ChessFarmer(x + 112, y + 96, true, this);
        }
コード例 #4
0
ファイル: ChessQueenTests.cs プロジェクト: raosong/Practices
        public void ChessQueen_Existing8_Test()
        {
            ChessQueen cq     = new ChessQueen();
            var        result = cq.PlaceQueen(8);

            result.Should().NotBeNull("Result should not be null.");
            result[0].Should().Be(0, "Result[0] is incorrect.");
            result[1].Should().Be(4, "Result[1] is incorrect.");
            result[2].Should().Be(7, "Result[2] is incorrect.");
            result[3].Should().Be(5, "Result[3] is incorrect.");
            result[4].Should().Be(2, "Result[4] is incorrect.");
            result[5].Should().Be(6, "Result[5] is incorrect.");
            result[6].Should().Be(1, "Result[6] is incorrect.");
            result[7].Should().Be(3, "Result[7] is incorrect.");
        }