Compare commits
3 Commits
540d3135d2
...
d67bed7efb
| Author | SHA1 | Date | |
|---|---|---|---|
| d67bed7efb | |||
| a77e10e983 | |||
| efa8485a4c |
9
main.cpp
9
main.cpp
|
|
@ -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');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user