Browse Source

renamed INextValueCHooser

master
Robin Thoni 7 years ago
parent
commit
25d9f527f3

uqac-ia-sudoku-csp/Interfaces/INextValueChooser.cs → uqac-ia-sudoku-csp/Interfaces/INextCellChooser.cs View File

2
 
2
 
3
 namespace uqac_ia_sudoku_csp.Interfaces
3
 namespace uqac_ia_sudoku_csp.Interfaces
4
 {
4
 {
5
-    public interface INextValueChooser
5
+    public interface INextCellChooser
6
     {
6
     {
7
         void SelectVariable(Board board, out int x, out int y, IList<IConstraint> constraints);
7
         void SelectVariable(Board board, out int x, out int y, IList<IConstraint> constraints);
8
     }
8
     }

+ 4
- 4
uqac-ia-sudoku-csp/Program.cs View File

52
             generator.Generate(board, data);
52
             generator.Generate(board, data);
53
             board.Print(Console.Out);
53
             board.Print(Console.Out);
54
 
54
 
55
-            INextValueChooser nextValueChooser = null;
55
+            INextCellChooser nextCellChooser = null;
56
             if (valueChooser == "mrv")
56
             if (valueChooser == "mrv")
57
             {
57
             {
58
-                nextValueChooser = new MRVNextValueChooser();
58
+                nextCellChooser = new MrvNextCellChooser();
59
             }
59
             }
60
             else if (valueChooser == "basic")
60
             else if (valueChooser == "basic")
61
             {
61
             {
62
-                nextValueChooser = new BasicNextValueChooser();
62
+                nextCellChooser = new BasicNextCellChooser();
63
             }
63
             }
64
             else
64
             else
65
             {
65
             {
67
                 Environment.Exit(64);
67
                 Environment.Exit(64);
68
             }
68
             }
69
 
69
 
70
-            var solver = new BacktrackSearch(nextValueChooser);
70
+            var solver = new BacktrackSearch(nextCellChooser);
71
             var resolved = solver.Resolve(board);
71
             var resolved = solver.Resolve(board);
72
 
72
 
73
             if (resolved.Success)
73
             if (resolved.Success)

+ 4
- 4
uqac-ia-sudoku-csp/Solver/BacktrackSearch.cs View File

8
 {
8
 {
9
     public class BacktrackSearch : ISolver
9
     public class BacktrackSearch : ISolver
10
     {
10
     {
11
-        private readonly INextValueChooser _nextValueChooser;
11
+        private readonly INextCellChooser _nextCellChooser;
12
         protected IList<IConstraint> Constraints;
12
         protected IList<IConstraint> Constraints;
13
 
13
 
14
-        public BacktrackSearch(INextValueChooser nextValueChooser)
14
+        public BacktrackSearch(INextCellChooser nextCellChooser)
15
         {
15
         {
16
-            _nextValueChooser = nextValueChooser;
16
+            _nextCellChooser = nextCellChooser;
17
             Constraints = new List<IConstraint>
17
             Constraints = new List<IConstraint>
18
             {
18
             {
19
                 new LineContraint(),
19
                 new LineContraint(),
40
                 return true;
40
                 return true;
41
             }
41
             }
42
             int x, y;
42
             int x, y;
43
-            _nextValueChooser.SelectVariable(board, out x, out y, Constraints);
43
+            _nextCellChooser.SelectVariable(board, out x, out y, Constraints);
44
             if (x != -1 && y != -1)
44
             if (x != -1 && y != -1)
45
             {
45
             {
46
                 foreach (var value in domain)
46
                 foreach (var value in domain)

uqac-ia-sudoku-csp/Solver/NextValueChoosers/BasicNextValueChooser.cs → uqac-ia-sudoku-csp/Solver/NextCellChoosers/BasicNextCellChooser.cs View File

3
 
3
 
4
 namespace uqac_ia_sudoku_csp.Solver.NextValueChoosers
4
 namespace uqac_ia_sudoku_csp.Solver.NextValueChoosers
5
 {
5
 {
6
-    public class BasicNextValueChooser : INextValueChooser
6
+    public class BasicNextCellChooser : INextCellChooser
7
     {
7
     {
8
         public void SelectVariable(Board board, out int x, out int y, IList<IConstraint> constraints)
8
         public void SelectVariable(Board board, out int x, out int y, IList<IConstraint> constraints)
9
         {
9
         {

uqac-ia-sudoku-csp/Solver/NextValueChoosers/MRVNextValueChooser.cs → uqac-ia-sudoku-csp/Solver/NextCellChoosers/MrvNextCellChooser.cs View File

3
 
3
 
4
 namespace uqac_ia_sudoku_csp.Solver.NextValueChoosers
4
 namespace uqac_ia_sudoku_csp.Solver.NextValueChoosers
5
 {
5
 {
6
-    public class MRVNextValueChooser : INextValueChooser
6
+    public class MrvNextCellChooser : INextCellChooser
7
     {
7
     {
8
         public void SelectVariable(Board board, out int x, out int y, IList<IConstraint> constraints)
8
         public void SelectVariable(Board board, out int x, out int y, IList<IConstraint> constraints)
9
         {
9
         {

Loading…
Cancel
Save