예제 #1
0
        // Fonction qui lance la résolution du Taquin courant
        public void SolveButton_Click(object sender, EventArgs e)
        {
            // On crée un EvaluableBoard a partir de l'état courant du Taquin
            EvaluableBoard board = new EvaluableBoard(taquin.Board);

            // On envoie le board et le solver courant a un resultForm que l'on affiche
            if (_solver.GetType() == typeof(AstarUni))
            {
                _solver = new AstarUni(_selectedHeuristic);
            }
            else if (_solver.GetType() == typeof(IDAstar))
            {
                _solver = new IDAstar(_selectedHeuristic);
            }
            else
            {
                _solver = new Segments(_selectedHeuristic);
            }
            _resultForm = new ResultForm(_solver, board);
            _resultForm.Show();
        }
예제 #2
0
 public MainForm()
 {
     InitializeComponent();
     // Initialisation des paramètres internes du Form
     _resultForm            = new ResultForm();
     _fileName              = "";
     _loadForm              = new LoadForm();
     _loadForm.FormClosing += (s, e) => LoadForm_Close(s, e);
     // Défini la taille, 3x3 par défault
     _selectedSize = 3;
     ButtonSetFocus(sizeButton3);
     // Define Heuristic
     _selectedHeuristic = new Manhattan();
     ButtonSetFocus(heuristicThreeButton);
     // Define Solver
     _solver = new AstarUni(_selectedHeuristic);
     ButtonSetFocus(AstarUniButton);
     taquin = new Taquin(_selectedSize);
     //Debug.WriteLine(taquin);
     SetBoard();
 }