doing calculate fitness score function