from here https://github.com/hjweide/a-star to make the evaluation/fitness function ready for large scale comptuation