0001 inline Cell* neighbor ( Cell* cell ) { //查询当前位置的相邻格点 0002 switch ( cell->outgoing ) { 0003 case EAST : return cell + LABY_MAX; //向东 0004 case SOUTH : return cell + 1; //向南 0005 case WEST : return cell - LABY_MAX; //向西 0006 case NORTH : return cell - 1; //向北 0007 default : exit ( -1 ); 0008 } 0009 }