Fixed a bug in miniMax function to calculate the right score for a routine