Skip to content

Commit 94ce2c6

Browse files
committed
C适配层,不过输出结果貌似不对。
1 parent 3ddf254 commit 94ce2c6

File tree

1 file changed

+3
-36
lines changed

1 file changed

+3
-36
lines changed

src/algorithm_module/c_adapt.cpp

+3-36
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,9 @@ namespace Algorithm
44
{
55
namespace Graph
66
{
7-
/*typedef int(*_FirstEdgeAdapter)(int idx_v);
8-
typedef int(*_NextEdgeAdapter)(int idx_v, int idx_e);
9-
typedef int(*_EdgeToAdapter)(int idx_v, int idx_e);
10-
PathType bfsResult;
11-
std::vector<int> pointVector, edgeVector;
12-
C_PUBLIC void RunBfs(int idx_start_v, int idx_dest_v,
13-
_FirstEdgeAdapter firstOf,
14-
_NextEdgeAdapter nextOf,
15-
_EdgeToAdapter destOf)
16-
{
17-
bfsResult = bfs(idx_start_v, idx_dest_v, FirstEdgeAdapter(firstOf), NextEdgeAdapter(nextOf), EdgeToAdapter(destOf));
18-
pointVector = std::vector<int>(bfsResult.first.begin(), bfsResult.first.end());
19-
edgeVector = std::vector<int>(bfsResult.second.begin(), bfsResult.second.end());
20-
21-
};
22-
C_PUBLIC int* GetPointListPointer()
23-
{
24-
return &pointVector[0];
25-
}
26-
C_PUBLIC int GetPointListLength()
27-
{
28-
return pointVector.size();
29-
}
30-
C_PUBLIC int* GetEdgeListPointer()
31-
{
32-
return &edgeVector[0];
33-
}
34-
C_PUBLIC int GetEdgeListLength()
35-
{
36-
return edgeVector.size();
37-
}*/
38-
397
const int maxn = 30;
408
int a, b, t;
41-
char*** s;
9+
char s[maxn][maxn][maxn];
4210

4311
struct Node
4412
{
@@ -88,20 +56,19 @@ namespace Algorithm
8856
walk
8957
};
9058

91-
C_PUBLIC int EscapeMaze(int floors, int height, int width, char*** mazeData)
59+
C_PUBLIC int EscapeMaze(int floors, int height, int width, char mazeData[maxn][maxn][maxn])
9260
{
9361
t = floors;
9462
a = height;
9563
b = width;
96-
s = mazeData;
9764
int start, dest;
9865
for (int i = 0; i < t; i++)
9966
{
10067
for (int j = 0; j < a; j++)
10168
{
102-
scanf_s("%s", s[i][j], 1024);
10369
for (int k = 0; k < b; k++)
10470
{
71+
s[i][j][k] = mazeData[i][j][k];
10572
if (s[i][j][k] == 'S')
10673
{
10774
start = encoder(i, j, k);

0 commit comments

Comments
 (0)