without comments
This commit is contained in:
parent
5648b27810
commit
5ff8392c28
@ -82,7 +82,6 @@ int main(void) {
|
|||||||
/* the **algorithm**, trace*/
|
/* the **algorithm**, trace*/
|
||||||
|
|
||||||
while (currentCell.x != targetCell.x || currentCell.y != targetCell.y) {
|
while (currentCell.x != targetCell.x || currentCell.y != targetCell.y) {
|
||||||
//printf("test\n");
|
|
||||||
const int neighbours[4][2]={{1,0},{0,1},{0,-1},{-1,0}};
|
const int neighbours[4][2]={{1,0},{0,1},{0,-1},{-1,0}};
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
cell neighbourCell;
|
cell neighbourCell;
|
||||||
@ -93,30 +92,6 @@ int main(void) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*int moved=0;
|
|
||||||
if (currentCell.x!=12) {
|
|
||||||
if (assignmentMatrix[currentCell.x+1][currentCell.y] < assignmentMatrix[currentCell.x][currentCell.y] && assignmentMatrix[currentCell.x+1][currentCell.y] != -1) {
|
|
||||||
currentCell.x=currentCell.x+1;
|
|
||||||
moved=1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (currentCell.x!=0 && moved==0) {
|
|
||||||
if (assignmentMatrix[currentCell.x-1][currentCell.y] < assignmentMatrix[currentCell.x][currentCell.y] && assignmentMatrix[currentCell.x-1][currentCell.y] != -1) {
|
|
||||||
currentCell.x=currentCell.x-1;
|
|
||||||
moved=1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (currentCell.y!=12 && moved==0) {
|
|
||||||
if (assignmentMatrix[currentCell.x][currentCell.y+1] < assignmentMatrix[currentCell.x][currentCell.y] && assignmentMatrix[currentCell.x][currentCell.y+1] != -1) {
|
|
||||||
currentCell.y=currentCell.y+1;
|
|
||||||
moved=1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (currentCell.y!=0 && moved==0) {
|
|
||||||
if (assignmentMatrix[currentCell.x][currentCell.y-1] < assignmentMatrix[currentCell.x][currentCell.y] && assignmentMatrix[currentCell.x][currentCell.y-1] != -1) {
|
|
||||||
currentCell.y=currentCell.y-1;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
if ( isValidCrossing(¤tCell)) {
|
if ( isValidCrossing(¤tCell)) {
|
||||||
printCrossingName(currentCell.x, currentCell.y);
|
printCrossingName(currentCell.x, currentCell.y);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user