コード例 #1
0
        public void CheckTakeDownTest_DoubleJump()
        {
            //Associate
            Int64[,] board = new Int64[, ]
            {
                { 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, 1, 0, 5, 0 },
                { 0, 5, 0, 5, 0, 5, 0, 1 },
                { 1, 0, 5, 0, 1, 0, 1, 0 },
                { 0, 1, 0, 1, 0, 1, 0, 5 },
                { 1, 0, 1, 0, 1, 0, 1, 0 },
            };
            Int64 height = 2;
            Int64 width  = 3;

            Int64[] listOfPiecesToTake = new Int64[] { 1 };
            Tree    tree = new Tree(new TreeTake
            {
                CurrentHeight = height,
                CurrentWidth  = width,
            });

            //Act
            Tree resultTree = CheckMove.CheckTakeDown(board, height, width, listOfPiecesToTake, tree);

            //Assert
            Assert.AreEqual(6, resultTree.Right.Right.Value.CurrentHeight);
            Assert.AreEqual(7, resultTree.Right.Right.Value.CurrentWidth);
        }
コード例 #2
0
        public void CheckTakeDownTest()
        {
            //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, 2, 0, 5, 0 },
                { 0, 5, 0, 1, 0, 5, 0, 5 },
                { 1, 0, 5, 0, 1, 0, 1, 0 },
                { 0, 1, 0, 1, 0, 1, 0, 1 },
                { 1, 0, 1, 0, 1, 0, 1, 0 },
            };
            Int64 height = 3;
            Int64 width  = 4;

            Int64[] listOfPiecesToTake = new Int64[] { 1 };
            Tree    tree = new Tree(new TreeTake
            {
                CurrentHeight = height,
                CurrentWidth  = width,
            });

            //Act
            Tree resultTree = CheckMove.CheckTakeDown(board, height, width, listOfPiecesToTake, tree);

            //Assert
            Assert.AreEqual(5, resultTree.Left.Value.CurrentHeight);
            Assert.AreEqual(2, resultTree.Left.Value.CurrentWidth);
            Assert.AreEqual(4, resultTree.Left.Value.TakeHeight);
            Assert.AreEqual(3, resultTree.Left.Value.TakeWidth);
            Assert.IsNull(resultTree.Right);
        }