diff --git a/main.cpp b/main.cpp index 60468b3..df0803f 100644 --- a/main.cpp +++ b/main.cpp @@ -7,8 +7,8 @@ #define W 15 /* ancho y alto del laberinto -1 */ struct maze { /* Distancias de Manhattan */ - int vwalls[15][15]; - int hwalls[15][15]; + int vwalls[16][16]; + int hwalls[16][16]; int mhtn[16][16]; } maze; @@ -23,8 +23,8 @@ void updatepos(class mmstats *mms); void locateWall(struct maze &maze); void flood(struct maze *maze, struct mmstats *mmstats, int coordinates[2]) { - int i, j; - int prevNum; + int i = 0, j = 0; + int prevNum = 0; int marked[16][16] = {0}; std::queue myqueue; @@ -36,7 +36,7 @@ void flood(struct maze *maze, struct mmstats *mmstats, int coordinates[2]) { prevNum = myqueue.front().z; myqueue.pop(); - if (i < 0 || i > W || j < 0 || j > W || marked[i][j] == 1) { + if (i < 0 || i > W || j < 0 || j > W || marked[i][j]) { continue; } else { API::setText(i, j, prevNum + 1);