Implement maximin algorithm