Minimax refactoring