moved minimax until it works.