コード例 #1
0
ファイル: RayTests.cs プロジェクト: RAWhitf18/Shutranj
 public void TestDiagonalForSquare()
 {
     TestingHelper helper = new TestingHelper();
     Initialiser bitboards = new Initialiser();
     UInt64 diag = bitboards.GetDiagonalForSquare(18);
     string boardString = helper.BitboardToBoardString(diag);
     Debug.WriteLine(boardString);
 }
コード例 #2
0
ファイル: RayTests.cs プロジェクト: RAWhitf18/Shutranj
 public void TestFileRaysInitialisation()
 {
     Initialiser fileRayBitboard = new Initialiser();
     UInt64[] fileRays = fileRayBitboard.InitialiseFileRays();
     TestingHelper helper = new TestingHelper();
     string fileRayBoardString = helper.BitboardToBoardString(fileRays[5]);
     Debug.WriteLine(fileRayBoardString);
 }
コード例 #3
0
ファイル: BoardString.cs プロジェクト: RAWhitf18/Shutranj
        public void TestConversionToBitboard()
        {
            UInt64 bitboard = 1000965;
            TestingHelper helper = new TestingHelper();
            string boardString = helper.BitboardToBoardString(bitboard);

            Debug.WriteLine(boardString);
        }
コード例 #4
0
ファイル: BoardString.cs プロジェクト: RAWhitf18/Shutranj
        public void TestConversionToBinary()
        {
            UInt64 bitboard = 1;
            TestingHelper helper = new TestingHelper();
            string binaryString = helper.BitboardToBinaryString(bitboard);

            Assert.AreEqual(binaryString, "1".PadLeft(64, '0'));
        }
コード例 #5
0
ファイル: RayTests.cs プロジェクト: RAWhitf18/Shutranj
        public void TestEastRayInitialisation()
        {
            Initialiser eastRayBitboard = new Initialiser();

            UInt64[] eastRayBoard = eastRayBitboard.InitialiseEast();
            TestingHelper helper = new TestingHelper();
            string eastRayBoardString = helper.BitboardToBoardString(eastRayBoard[0]);
            Debug.WriteLine(eastRayBoardString);
        }
コード例 #6
0
ファイル: RayTests.cs プロジェクト: RAWhitf18/Shutranj
 public void TestDiagonalValues()
 {
     TestingHelper helper = new TestingHelper();
     Initialiser bitboards = new Initialiser();
     UInt64[] rankDiags = bitboards.InitialiseRankDiagonals();
     UInt64 diag = rankDiags[0] << 18;
     string boardString = helper.BitboardToBoardString(diag);
     Debug.WriteLine(boardString);
 }
コード例 #7
0
ファイル: RayTests.cs プロジェクト: RAWhitf18/Shutranj
 public void TestAntiDiagonals()
 {
     TestingHelper helper = new TestingHelper();
     Initialiser antiDiagsInitialiser = new Initialiser();
     UInt64[] fileAntiDiags = antiDiagsInitialiser.InitialiseFileAntiDiagonals();
     UInt64 northWestRay = fileAntiDiags[5]>>7;
     string antiDiagonalBoardString = helper.BitboardToBoardString(northWestRay);
     Debug.WriteLine(antiDiagonalBoardString);
 }
コード例 #8
0
ファイル: RayTests.cs プロジェクト: RAWhitf18/Shutranj
        public void TestAntiDiagonalForSquare()
        {
            TestingHelper helper = new TestingHelper();
            Initialiser antiDiagsForSquare = new Initialiser();

            UInt64 antiDiag = antiDiagsForSquare.GetAntiDiagonalForSquare(63);
            string boardString = helper.BitboardToBoardString(antiDiag);
            Debug.WriteLine(boardString);
        }
コード例 #9
0
ファイル: RayTests.cs プロジェクト: RAWhitf18/Shutranj
        public void TestFirstSquareOfDiagonal()
        {
            TestingHelper helper = new TestingHelper();
            Initialiser bitboards = new Initialiser();
            UInt64[] rankDiags = bitboards.InitialiseRankDiagonals();
            UInt64 diag = rankDiags[1];

            UInt64 firstSquare = diag & ~(diag - 1);
            // OptimiseTODO: consider bit-shifting instead of log. see http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=bitManipulation
            int firstSquareIndex = (int)Math.Log(firstSquare, 2);
            Debug.WriteLine(firstSquareIndex);
            string boardString = helper.BitboardToBoardString(firstSquare);
            Debug.WriteLine(boardString);
        }
コード例 #10
0
ファイル: RayTests.cs プロジェクト: RAWhitf18/Shutranj
        public void TestMS1B()
        {
            TestingHelper testingHelper = new TestingHelper();
            Initialiser bitboards = new Initialiser();
            UInt64[] rankDiags = bitboards.InitialiseRankDiagonals();
            UInt64 diag = Constants.MainDiagonal;
                //rankDiags[1];

            BitHelper bitHelper = new BitHelper();

            UInt64 ms1b = bitHelper.GetMostSignificant1Bit(diag);
            Debug.WriteLine("Diagonal:");
            Debug.WriteLine(testingHelper.BitboardToBoardString(diag));
            Debug.WriteLine("MS1B:");
            Debug.WriteLine(testingHelper.BitboardToBoardString(ms1b));
        }
コード例 #11
0
ファイル: RayTests.cs プロジェクト: RAWhitf18/Shutranj
        public void TestWestRayInitialisation()
        {
            Initialiser westRayBitboard = new Initialiser();

            UInt64[] westRayBoard = westRayBitboard.InitialiseWest();
            TestingHelper helper = new TestingHelper();
            string westRayBoardString = helper.BitboardToBoardString(westRayBoard[48]);
            Debug.WriteLine(westRayBoardString);
        }
コード例 #12
0
ファイル: RayTests.cs プロジェクト: RAWhitf18/Shutranj
        public void TestSouthWestRayInitialisation()
        {
            Initialiser southWestRayBitboard = new Initialiser();

            UInt64[] southWestRayBoard = southWestRayBitboard.InitialiseSouthWest();
            TestingHelper helper = new TestingHelper();
            string southWestRayBoardString = helper.BitboardToBoardString(southWestRayBoard[34]);
            Debug.WriteLine(southWestRayBoardString);
        }
コード例 #13
0
ファイル: RayTests.cs プロジェクト: RAWhitf18/Shutranj
        public void TestNorthWestRayInitialisation()
        {
            Initialiser northWestRayBitboard = new Initialiser();

            UInt64[] northWestRayBoard = northWestRayBitboard.InitialiseNorthWest();
            TestingHelper helper = new TestingHelper();
            string northWestRayBoardString = helper.BitboardToBoardString(northWestRayBoard[19]);
            Debug.WriteLine(northWestRayBoardString);
        }
コード例 #14
0
ファイル: RayTests.cs プロジェクト: RAWhitf18/Shutranj
        public void TestMS1BMask()
        {
            TestingHelper testingHelper = new TestingHelper();
            Initialiser bitboards = new Initialiser();
            UInt64[] rankDiags = bitboards.InitialiseRankDiagonals();
            UInt64 diag = rankDiags[1];

            BitHelper bitHelper = new BitHelper();

            UInt64 mask = bitHelper.GetMostSignificant1BitMask(diag);
            Debug.WriteLine("Diagonal:");
            Debug.WriteLine(testingHelper.BitboardToBoardString(diag));
            Debug.WriteLine("Mask:");
            Debug.WriteLine(testingHelper.BitboardToBoardString(mask));
        }
コード例 #15
0
ファイル: RayTests.cs プロジェクト: RAWhitf18/Shutranj
        public void TestMS1BIndex()
        {
            TestingHelper testingHelper = new TestingHelper();
            Initialiser bitboards = new Initialiser();
            UInt64[] rankDiags = bitboards.InitialiseRankDiagonals();
            UInt64 diag = rankDiags[1];

            BitHelper bitHelper = new BitHelper();

            int ms1bIndex = BitHelper.GetMostSignificant1BitIndex2(diag);
                // bitHelper.GetMostSignificant1BitIndex(diag);
            Debug.WriteLine("Diagonal:");
            Debug.WriteLine(testingHelper.BitboardToBoardString(diag));
        }