CONTINUED minimax implementation
ADJUSTED to fit minimax