Esempio n. 1
0
        public void CheckKingTake()
        {
            //Associate
            Int64[,] board = new Int64[, ]
            {
                { 0, 2, 0, 2, 0, 2, 0, 2 },
                { 2, 0, 2, 0, 2, 0, 2, 0 },
                { 0, 2, 0, 5, 0, 2, 0, 2 },
                { 5, 0, 5, 0, 5, 0, 5, 0 },
                { 0, 4, 0, 2, 0, 5, 0, 5 },
                { 5, 0, 5, 0, 5, 0, 5, 0 },
                { 0, 5, 0, 2, 0, 5, 0, 5 },
                { 5, 0, 3, 0, 5, 0, 5, 0 },
            };
            Int64 preHeight = 7;
            Int64 preWidth  = 2;
            Int64 height    = 7;
            Int64 width     = 2;

            Int64[]  listOfPiecesToTake = new Int64[] { 2, 4 };
            KingTree tree = new KingTree(new TreeTake
            {
                CurrentHeight = height,
                CurrentWidth  = width,
            });

            //Act
            KingTree resultTree = CheckMove.CheckKingTake(board, preHeight, preWidth, height, width, listOfPiecesToTake, tree);

            //Assert
            Assert.AreEqual(6, resultTree.UpRight.Value.TakeHeight);
            Assert.AreEqual(4, resultTree.UpRight.Value.CurrentWidth);
        }
Esempio n. 2
0
        public void KingTreeToArray_BasicTest()
        {
            //Associate
            KingTree tree = new KingTree(new TreeTake
            {
                CurrentHeight = 1,
                CurrentWidth  = 1
            });

            tree.DownLeft = new KingTree(new TreeTake
            {
                TakeHeight = 2,
                TakeWidth  = 2,
                NextHeight = 2,
                NextWidth  = 2,
            });

            tree.DownRight = new KingTree(new TreeTake
            {
                TakeHeight = 3,
                TakeWidth  = 3,
                NextHeight = 3,
                NextWidth  = 3,
            });

            tree.UpLeft = new KingTree(new TreeTake
            {
                TakeHeight = 4,
                TakeWidth  = 4,
                NextHeight = 4,
                NextWidth  = 4,
            });

            tree.UpRight = new KingTree(new TreeTake
            {
                TakeHeight = 5,
                TakeWidth  = 5,
                NextHeight = 5,
                NextWidth  = 5,
            });

            //Act
            List <List <TreeTake> > result = KingTree.KingTreeToArray(tree);

            //Assert
            Assert.AreEqual(4, result.Count);
        }
Esempio n. 3
0
        public void CheckMove_CheckKingTake()
        {
            //Associate
            int[,] board = new int[, ] {
                { 0, 2, 0, 2, 0, 2, 0, 2 },
                { 2, 0, 2, 0, 2, 0, 2, 0 },
                { 0, 2, 0, 2, 0, 2, 0, 2 },
                { 5, 0, 5, 0, 5, 0, 5, 0 },
                { 0, 5, 0, 5, 0, 5, 0, 5 },
                { 1, 0, 1, 0, 1, 0, 1, 0 },
                { 0, 1, 0, 1, 0, 1, 0, 1 },
                { 1, 0, 1, 0, 1, 0, 1, 0 },
            };

            //Act

            KingTree tree = new KingTree(new TreeTake
            {
                CurrentHeight = 1,
                CurrentWidth  = 1
            });

            //Assert
        }