Compare commits
2 Commits
5236a776fb
...
56146689b4
| Author | SHA1 | Date | |
|---|---|---|---|
| 56146689b4 | |||
| 1c303c7fd0 |
10
main.cpp
10
main.cpp
|
|
@ -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);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user