Compare commits

..

3 Commits

Author SHA1 Message Date
d67bed7efb Floodfill completado 2024-08-09 18:25:11 -06:00
a77e10e983 El micromouse sabe llegar al centro 2024-08-09 18:18:25 -06:00
efa8485a4c primer intento de resolver el laberinto wip 2024-08-09 18:16:30 -06:00

View File

@ -6,7 +6,6 @@
#define W 15 /* ancho y alto del laberinto -1 */
struct maze { /* Distancias de Manhattan */
int vwalls[15][15];
int hwalls[15][15];
@ -119,13 +118,15 @@ void follow(struct maze maze, class mmstats* mms) {
log("180");
return;
}
else if(maze.mhtn[next_R[0]][next_R[1]] <= maze.mhtn[next_B[0]][next_B[1]] && (API::wallFront() && API::wallLeft())){
else if(maze.mhtn[next_R[0]][next_R[1]] <= maze.mhtn[next_B[0]][next_B[1]] && !API::wallRight()){
API::turnRight();
mms->turn(right);
log("bRight");
}
else if(maze.mhtn[next_L[0]][next_L[1]] <= maze.mhtn[next_B[0]][next_B[1]] && (API::wallFront() && API::wallRight())){
else if(maze.mhtn[next_L[0]][next_L[1]] <= maze.mhtn[next_B[0]][next_B[1]] && !API::wallLeft()){
API::turnLeft();
mms->turn(left);
log("bLeft");
}
log("error en la matri");
}
@ -215,7 +216,7 @@ void locateWall(struct maze* maze, class mmstats *mms) {
maze->hwalls[mms->x][mms->y -1] = 1;
API::setWall(mms->x, mms->y -1, 'n');
}
if(API::wallRight() && mms->y != 0){
if(API::wallRight() && mms->y != 15){
maze->hwalls[mms->x][mms->y] = 1;
API::setWall(mms->x, mms->y, 'n');
}