Exemplo n.º 1
0
        public void Get_Cell_At_Coordinate()
        {
            Sudoku sudoku = new Sudoku(soduku_full);

            // Act
            var graph = sudoku.Graphs[0, 1];

            // Assert
            Assert.AreEqual(4, sudoku.CellAt(1, 0).Value);
            Assert.AreEqual(4, sudoku.CellAt(6, 1).Value);
            Assert.AreEqual(4, sudoku.CellAt(2, 4).Value);
            Assert.AreEqual(4, sudoku.CellAt(4, 5).Value);
            Assert.AreEqual(4, sudoku.CellAt(5, 7).Value);
            Assert.AreEqual(4, sudoku.CellAt(7, 8).Value);
        }
Exemplo n.º 2
0
        public void Update_Cost()
        {
            // Arrange
            int[,] soduku_full = new int[, ] {
                { 9, 4, 0, 0, 0, 0, 5, 0, 8 },
                { 0, 0, 3, 0, 8, 1, 4, 2, 0 },
                { 1, 0, 0, 0, 2, 0, 0, 0, 0 },
                { 6, 9, 0, 0, 0, 5, 0, 8, 0 },
                { 0, 5, 4, 9, 0, 0, 0, 3, 7 },
                { 2, 3, 0, 8, 4, 0, 9, 5, 0 },
                { 0, 1, 8, 7, 6, 2, 0, 0, 0 },
                { 0, 7, 0, 0, 0, 4, 0, 0, 2 },
                { 5, 0, 0, 0, 9, 0, 0, 4, 0 }
            };

            int[,] costs = new int[, ]
            {
                { 0, 0, 3, 2, 2, 3, 0, 3, 0, },
                { 1, 1, 0, 2, 0, 0, 0, 0, 2, },
                { 0, 2, 3, 4, 0, 4, 3, 3, 3, },
                { 0, 0, 2, 3, 3, 0, 2, 0, 2, },
                { 1, 0, 0, 0, 1, 1, 3, 0, 0, },
                { 0, 0, 2, 0, 0, 2, 0, 0, 2, },
                { 2, 0, 0, 0, 0, 0, 1, 1, 3, },
                { 1, 0, 2, 3, 3, 0, 4, 3, 0, },
                { 0, 2, 2, 2, 0, 2, 5, 0, 3, }
            };

            // Act
            Sudoku sudoku = new Sudoku(soduku_full);

            // Assert
            for (int x = 0; x < 9; x++)
            {
                for (int y = 0; y < 9; y++)
                {
                    var c = sudoku.CellAt(x, y);
                    Assert.AreEqual(costs[y, x], c.Cost);
                }
            }
        }