Getting the index of the returned max or min item using max()/min() on a list

I’m using Python’s max and min functions on lists for a minimax algorithm, and I need the index of the value returned by max() or min(). In other words, I need to know which move produced the max (at a first player’s turn) or min (second player) value. for i in range(9): new_board = current_board.new_board_with_move([i … Read more

How can I SELECT rows with MAX(Column value), PARTITION by another column in MYSQL?

My table is: id home datetime player resource 1 10 04/03/2009 john 399 2 11 04/03/2009 juliet 244 5 12 04/03/2009 borat 555 3 10 03/03/2009 john 300 4 11 03/03/2009 juliet 200 6 12 03/03/2009 borat 500 7 13 24/12/2008 borat 600 8 13 01/01/2009 borat 700 I need to select each distinct home … Read more