basic minimax implementation