From 1c303c7fd0bdd00fea746572bba09a5abe070870 Mon Sep 17 00:00:00 2001 From: fernando Date: Sat, 19 Apr 2025 22:13:11 -0600 Subject: [PATCH] vwalls and hwalls redefined as 16x16 insthead of 15x15 --- main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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);