got minimax algorithm working with proper weighting