I would like to sort a list using a function that returns a float value. If the function had a single argument, I would simply use
sorted(mylist, key=myfunction)
and be on my merry way. However, this doesn't work for functions with multiple arguments. How can this be done?
This is a small part of a chess engine. The 'Bestmove' function takes in the board position (a list), the depth (an integer), and alpha/beta values and returns a list with two entries: the board evaluation (a float), and the suggested move (a list).
In an effort to optimize the alpha/beta pruning process, I would like to change the order in which moves are evaluated (strong moves evaluated first leads to greater efficiency). To achieve this, I would like to sort the list of moves by the first value in the list returned by the 'Bestmove' function.