Basic implementation of minimax