Merge pull request 'vwalls and hwalls redefined as 16x16 insthead of 15x15' (#4) from flood_edges into main

Reviewed-on: #4
This commit is contained in:
Fernando 2025-04-19 22:19:51 -06:00
commit 56146689b4

View File

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