void Maze() { MYCOORD<int> present, next(start); int direction; do { if(!IsDeadCorner(next) && IsValid(next) && !mazepath.IsExist(next)) { present = next; mazepath.Push(present); if(present == end) break; direction = 1; next = present.Right_X(); } else { direction ++; if(direction == 2) { next = present.Down_Y(); } else if(direction == 3) { next = present.Left_X(); } else if(direction == 4) { next = present.Up_Y(); } else { dead_corner[p] = mazepath.Pop(); if(mazepath.IsEmpty()) break; present = mazepath.Top(); next = present; p ++; direction = 1; } } } while(!mazepath.IsEmpty()); }