Example #1
0
        public void TestConversionToBitboard()
        {
            UInt64        bitboard    = 1000965;
            TestingHelper helper      = new TestingHelper();
            string        boardString = helper.BitboardToBoardString(bitboard);

            Debug.WriteLine(boardString);
        }
Example #2
0
        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));
        }
Example #3
0
        public void TestDiagonalForSquare()
        {
            TestingHelper helper      = new TestingHelper();
            Initialiser   bitboards   = new Initialiser();
            UInt64        diag        = bitboards.GetDiagonalForSquare(18);
            string        boardString = helper.BitboardToBoardString(diag);

            Debug.WriteLine(boardString);
        }
Example #4
0
        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));
        }
Example #5
0
        public void TestSouthRayInitialisation()
        {
            Initialiser southRayBitboard = new Initialiser();

            UInt64[]      southRayBoard       = southRayBitboard.InitialiseSouth();
            TestingHelper helper              = new TestingHelper();
            string        southRayBoardString = helper.BitboardToBoardString(southRayBoard[63]);

            Debug.WriteLine(southRayBoardString);
        }
Example #6
0
        public void TestNorthRayInitialisation()
        {
            Initialiser northRayBitboard = new Initialiser();

            UInt64[]      northRayBoard       = northRayBitboard.InitialiseNorth();
            TestingHelper helper              = new TestingHelper();
            string        northRayBoardString = helper.BitboardToBoardString(northRayBoard[55]);

            Debug.WriteLine(northRayBoardString);
        }
Example #7
0
        public void TestFileRaysInitialisation()
        {
            Initialiser fileRayBitboard = new Initialiser();

            UInt64[]      fileRays           = fileRayBitboard.InitialiseFileRays();
            TestingHelper helper             = new TestingHelper();
            string        fileRayBoardString = helper.BitboardToBoardString(fileRays[5]);

            Debug.WriteLine(fileRayBoardString);
        }
Example #8
0
        public void TestWestRayInitialisation()
        {
            Initialiser westRayBitboard = new Initialiser();

            UInt64[]      westRayBoard       = westRayBitboard.InitialiseWest();
            TestingHelper helper             = new TestingHelper();
            string        westRayBoardString = helper.BitboardToBoardString(westRayBoard[48]);

            Debug.WriteLine(westRayBoardString);
        }
Example #9
0
        public void TestAntiDiagonalForSquare()
        {
            TestingHelper helper             = new TestingHelper();
            Initialiser   antiDiagsForSquare = new Initialiser();

            UInt64 antiDiag    = antiDiagsForSquare.GetAntiDiagonalForSquare(63);
            string boardString = helper.BitboardToBoardString(antiDiag);

            Debug.WriteLine(boardString);
        }
Example #10
0
        public void TestEastRayInitialisation()
        {
            Initialiser eastRayBitboard = new Initialiser();

            UInt64[]      eastRayBoard       = eastRayBitboard.InitialiseEast();
            TestingHelper helper             = new TestingHelper();
            string        eastRayBoardString = helper.BitboardToBoardString(eastRayBoard[0]);

            Debug.WriteLine(eastRayBoardString);
        }
Example #11
0
        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);
        }
Example #12
0
        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);
        }
Example #13
0
        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));
        }
Example #14
0
        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);
        }