Exemplo n.º 1
0
 // Devuelve la función que da los operadores aplicables, creándola por primera vez si no existiera
 public static ApplicableOperatorsFunction GetApplicableOperatorsFunction()
 {
     if (applicableOperatorsFunction == null)
     {
         applicableOperatorsFunction = new SlidingPuzzleApplicableOperatorsFunction();
     }
     return(applicableOperatorsFunction);
 }
Exemplo n.º 2
0
 // Crea un problema partiendo de todos sus componentes
 public Problem(object iSetup, ApplicableOperatorsFunction aoFunction, TransitionModel tModel, GoalTest gTest, StepCostFunction scFunction)
 {
     this.InitialSetup = iSetup;
     this.ApplicableOperatorsFunction = aoFunction;
     this.TransitionModel             = tModel;
     this.GoalTest         = gTest;
     this.StepCostFunction = scFunction;
 }
Exemplo n.º 3
0
        // Construye un resolutor de dimensiones (rows) por (columns), como mínimo debe ser de 1x1
        // No necesita el puzle en sí, pues eso lo recibirá después
        public SlidingPuzzleSolver(uint rows, uint columns)
        {
            if (rows == 0)
            {
                throw new ArgumentException(string.Format("{0} is not a valid rows value", rows), "rows");
            }
            if (columns == 0)
            {
                throw new ArgumentException(string.Format("{0} is not a valid columns value", columns), "columns");
            }

            aoFunction = SlidingPuzzleFunctionFactory.GetApplicableOperatorsFunction();
            tModel     = SlidingPuzzleFunctionFactory.GetTransitionModel();
            gTest      = new SlidingPuzzleGoalTest(rows, columns);
        }
Exemplo n.º 4
0
 // Crea un problema partiendo de todos sus componentes, menos la función de coste de paso donde se usará una por defecto
 public Problem(object iSetup, ApplicableOperatorsFunction aoFunction, TransitionModel tModel, GoalTest gTest)
     : this(iSetup, aoFunction, tModel, gTest, new DefaultStepCostFunction())
 {
 }