Compare commits
No commits in common. "d67bed7efb3ff4f202bb26a88f4d16acf812b240" and "540d3135d2d40506b7e20f02bb5d9a987f15bf7e" have entirely different histories.
d67bed7efb
...
540d3135d2
9
main.cpp
9
main.cpp
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#define W 15 /* ancho y alto del laberinto -1 */
|
||||
|
||||
|
||||
struct maze { /* Distancias de Manhattan */
|
||||
int vwalls[15][15];
|
||||
int hwalls[15][15];
|
||||
|
|
@ -118,15 +119,13 @@ 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::wallRight()){
|
||||
else if(maze.mhtn[next_R[0]][next_R[1]] <= maze.mhtn[next_B[0]][next_B[1]] && (API::wallFront() && API::wallLeft())){
|
||||
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::wallLeft()){
|
||||
else if(maze.mhtn[next_L[0]][next_L[1]] <= maze.mhtn[next_B[0]][next_B[1]] && (API::wallFront() && API::wallRight())){
|
||||
API::turnLeft();
|
||||
mms->turn(left);
|
||||
log("bLeft");
|
||||
}
|
||||
log("error en la matri");
|
||||
}
|
||||
|
|
@ -216,7 +215,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 != 15){
|
||||
if(API::wallRight() && mms->y != 0){
|
||||
maze->hwalls[mms->x][mms->y] = 1;
|
||||
API::setWall(mms->x, mms->y, 'n');
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user