def simultaneousSearch(self, state, legalMoves, bestMove, depth, alpha, beta): # Hack turnTaker = self.role moveSet = legalMoves[turnTaker] moveList = shuffle(list(moveSet)) if bestMove in moveSet: moveList.remove(bestMove) moveList.insert(0, bestMove) return self.maximize(state, legalMoves, bestMove, depth, alpha, beta, turnTaker, moveList)
def turnTakingSearch(self, state, legalMoves, bestMove, depth, alpha, beta, turnTaker): # Get legal moves for turn taker, putting the best one first moveSet = legalMoves[turnTaker] moveList = shuffle(list(moveSet)) if bestMove in moveSet: moveList.remove(bestMove) moveList.insert(0, bestMove) # MAX: this is a teammate if self.role == turnTaker: # self.gd.isTeammate(self.role, turnTaker): return self.maximize(state, legalMoves, bestMove, depth, alpha, beta, turnTaker, moveList) # MIN: this is an opponent else: return self.minimize(state, legalMoves, bestMove, depth, alpha, beta, turnTaker, moveList)
def turnTakingSearch(self, state, legalMoves, bestMove, depth, alpha, beta, turnTaker): # Get legal moves for turn taker, putting the best one first moveSet = legalMoves[turnTaker] moveList = shuffle(list(moveSet)) if bestMove in moveSet: moveList.remove(bestMove) moveList.insert(0, bestMove) # MAX: this is a teammate if self.role == turnTaker: #self.gd.isTeammate(self.role, turnTaker): return self.maximize(state, legalMoves, bestMove, depth, alpha, beta, turnTaker, moveList) # MIN: this is an opponent else: return self.minimize(state, legalMoves, bestMove, depth, alpha, beta, turnTaker, moveList)