Heuristic fixed. with proper distance computation and return 0 when all gems cleared.
Merge pull request #1 from fei6409/jer

Heuristic fixed. with proper distance computation and return 0 when all ...