Factored the minimax search into a separate generic module