generated from Tiphereth-A/TINplate
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b1e33d7
commit 2739bd3
Showing
6 changed files
with
85 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,15 @@ | ||
int k = 4; // 15-puzzle | ||
|
||
NPuzzleData start(k); | ||
|
||
// 初始化终止局面 | ||
std::vector<u32> fin(k * k); | ||
std::iota(fin.begin(), fin.end(), 0); | ||
NPuzzleData::set_fin(k, fin); | ||
// 初始化最大估价 | ||
tifa_libs::game::NPuzzleData::limit = 100; | ||
// 读入局面 | ||
std::cin >> start; | ||
// 输出当前局面 | ||
std::cout << start.node(); | ||
std::cout << start.node; | ||
// 输出操作步骤 | ||
std::cout << astar(start)->moves(); | ||
std::cout << astar(start)->moves; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#define PROBLEM "https://onlinejudge.u-aizu.ac.jp/courses/lesson/1/ALDS1/all/ALDS1_13_B" | ||
|
||
#include "../../code/game/npuzzle_data.hpp" | ||
#include "../../code/opt/astar.hpp" | ||
|
||
int main() { | ||
std::ios::sync_with_stdio(false); | ||
std::cin.tie(nullptr); | ||
tifa_libs::game::NPuzzleData start(3); | ||
std::vector<u32> fin(9); | ||
std::iota(fin.begin(), fin.end(), 1); | ||
fin.back() = 0; | ||
tifa_libs::game::NPuzzleData::set_fin(3, fin); | ||
tifa_libs::game::NPuzzleData::limit = 100; | ||
std::cin >> start; | ||
std::cout << tifa_libs::opt::astar(start)->moves.size() << '\n'; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.