示例#1
0
        public void FieldIsCircular()
        {
            string input  = "000820090500000000308040007100000040006402503000090010093004000004035200000700900";
            Parser parser = new Parser(input);

            Cell startCell   = parser.StartCell;
            Cell currentCell = startCell;

            for (int i = 0; i < 41; i++)
            {
                currentCell = currentCell.GetNextCell();
            }
            Assert.AreNotEqual(currentCell, startCell);

            for (int i = 0; i < 40; i++)
            {
                currentCell = currentCell.GetNextCell();
            }
            Assert.AreEqual(currentCell, startCell);
        }
示例#2
0
        public void AllCellsHaveAColumn()
        {
            string input       = "000820090500000000308040007100000040006402503000090010093004000004035200000700900";
            Parser parser      = new Parser(input);
            Cell   currentCell = parser.StartCell;

            for (int i = 0; i < 81; i++)
            {
                Assert.IsNotNull(currentCell.GetAssociatedColumn());
                currentCell = currentCell.GetNextCell();
            }
        }
示例#3
0
        public void SogyoFieldIsSolved()
        {
            string input  = "000820090500000000308040007100000040006402503000090010093004000004035200000700900";
            Parser parser = new Parser(input);

            Cell currentCell = parser.StartCell;

            for (int i = 0; i < 81; i++)
            {
                Assert.AreNotEqual('0', currentCell.GetValue());
                currentCell = currentCell.GetNextCell();
            }
        }
示例#4
0
        public void ReasonablySimpleFieldIsSolved()
        {
            string input  = "530070000600195000098000060800060003400803001700020006060000280000419005000080079";
            Parser parser = new Parser(input);

            Cell currentCell = parser.StartCell;

            for (int i = 0; i < 81; i++)
            {
                Assert.AreNotEqual('0', currentCell.GetValue());
                currentCell = currentCell.GetNextCell();
            }
        }
示例#5
0
        public void VeryEasyFieldIsSolved()
        {
            string input  = "483921057967345821250870093548132000729564138100798245300689514814200769605417002";
            Parser parser = new Parser(input);

            Cell currentCell = parser.StartCell;

            for (int i = 0; i < 81; i++)
            {
                Assert.AreNotEqual('0', currentCell.GetValue());
                currentCell = currentCell.GetNextCell();
            }
        }
示例#6
0
        public void SolvableCell3Solved()
        {
            string input  = "530070000600195000098000060800060003400803001700020006060000280000419005000080079";
            Parser parser = new Parser(input);

            Cell currentCell = parser.StartCell;

            for (int i = 0; i < 24; i++)
            {
                currentCell = currentCell.GetNextCell();
            }

            currentCell.UpdateAndConsiderPossibleValues();

            Assert.AreEqual('5', currentCell.GetValue());
        }
示例#7
0
        public void AllCellsHaveTheirExpectedColumn()
        {
            string input       = "000820090500000000308040007100000040006402503000090010093004000004035200000700900";
            Parser parser      = new Parser(input);
            Cell   currentCell = parser.StartCell;

            int[] expectedColumnNumbers = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8 };

            for (int i = 0; i < 81; i++)
            {
                if (expectedColumnNumbers[i] != currentCell.GetAssociatedColumn().GetColumnNumber())
                {
                    Console.WriteLine(expectedColumnNumbers[i] + " is verwacht op positie " + i + " maar werkelijke column is: " + currentCell.GetAssociatedColumn().GetColumnNumber());
                }
                Assert.AreEqual(expectedColumnNumbers[i], currentCell.GetAssociatedColumn().GetColumnNumber());
                currentCell = currentCell.GetNextCell();
            }
        }
示例#8
0
        public void SolvableCell2Solved()
        {
            //This cell is solvable without involvement of cells that are filled in already.
            //That is, all filled in cells are also covered under the influence of another 8.
            string input  = "530070000600195000098000060800060003400803001700020006060000280000419005000080079";
            Parser parser = new Parser(input);

            Cell currentCell = parser.StartCell;

            for (int i = 0; i < 64; i++)
            {
                currentCell = currentCell.GetNextCell();
            }

            currentCell.UpdateAndConsiderPossibleValues();

            Assert.AreEqual('8', currentCell.GetValue());
        }