This repository has been archived on 2023-04-18. You can view files and clone it, but cannot push or open issues or pull requests.
iaj/TP1/C-Cpp/src/r0.cpp

39 lines
777 B
C++
Raw Normal View History

2023-01-27 17:24:27 +01:00
#include "../includes/mysok.h"
2023-01-27 16:12:56 +01:00
2023-01-27 17:24:27 +01:00
int main(int _ac, char **_av) {
if (_ac != 2) {
printf("usage: %s SOK_FILE\n", _av[0]);
2023-01-27 17:49:36 +01:00
2023-01-27 17:24:27 +01:00
return 0;
}
2023-01-27 17:49:36 +01:00
2023-01-27 16:12:56 +01:00
sok_board_t S;
S.load(_av[1]);
S.print_board();
2023-01-27 17:49:36 +01:00
2023-02-19 18:23:59 +01:00
Node result;
2023-02-19 17:58:59 +01:00
result.state = S;
result.path = "";
result.path_len = 0;
2023-02-19 18:23:59 +01:00
/* if (bfs(result) == -1) {
std::cout << "Aucune solution trouvée\n";
} else {
std::cout << "Coups : " << result.path_len << "\n";
std::cout << "Solution : " << result.path << "\n";
} */
2023-02-21 14:09:08 +01:00
std::vector<Node> history;
if (dfs(result, 0, history) == -1) {
2023-02-19 17:58:59 +01:00
std::cout << "Aucune solution trouvée\n";
} else {
std::cout << "Coups : " << result.path_len << "\n";
std::cout << "Solution : " << result.path << "\n";
}
2023-02-21 14:46:03 +01:00
//result.state.print_board();
2023-02-19 17:58:59 +01:00
2023-01-27 16:12:56 +01:00
return 0;
}