Kevin Griffin - 10 months ago 52

Python Question

I'm using Python's

`max`

`min`

`max()`

`min()`

`for i in range(9):`

newBoard = currentBoard.newBoardWithMove([i / 3, i % 3], player)

if newBoard:

temp = minMax(newBoard, depth + 1, not isMinLevel)

values.append(temp)

if isMinLevel:

return min(values)

else:

return max(values)

I need to be able to return the actual index of the min or max value, not just the value.

Answer Source

if isMinLevel: return values.index(min(values)) else: return values.index(max(values))