reduced code in minimax implementation