public Puzzle(int n)
 {
     if (n < 2)
     {
         throw new ArgumentException("puzzles count should be at least two!");
     }
     InitialState = new State(n);
     GoalState    = new State(MatrixCalculations.GetMatrix(n, n));
     CurrentState = new State(InitialState.state);
 }
Exemple #2
0
 public State(State parent = null)
 {
     if (parent != null)
     {
         state = new int[parent.state.GetLength(0), parent.state.GetLength(1)];
         Array.Copy(parent.state, state, state.Length);
         this.Parent = parent;
     }
     else
     {
         state = MatrixCalculations.GetMatrix(3, 3);
         MatrixCalculations.Shuffle(state);
     }
 }
Exemple #3
0
 public State(int[,] initial)
 {
     state = MatrixCalculations.Copy(initial);
 }
Exemple #4
0
 public State(int n) : this(MatrixCalculations.GetMatrix(n, n))
 {
 }
Exemple #5
0
 public void Shuffle()
 {
     MatrixCalculations.Shuffle(state);
 }