Problem 10 (200pts): fastest_words

Implement fastest_words, which returns which words each player typed fastest. This function is called once both players have finished typing. It takes in a game.

Specifically, the fastest_words function returns a list of lists of words, one list for each player, and within each list the words they typed the fastest (against all the other players). In the case of a tie, consider the earliest player in the list (the smallest player index) to be the one who typed it the fastest.

For example consider the following game with the words 'Just', 'have', and 'fun'. Player 0 typed 'fun' the fastest (3 seconds), Player 1 typed 'Just' the fastest (4 seconds), and they tied on the word 'have' (both took 1 second) so we consider to Player 0 to be the fastest, because they are the earliest player in the list.

>>> player_0 = [5, 1, 3]
>>> player_1 = [4, 1, 6]
>>> fastest_words(game(['Just', 'have', 'fun'], [player_0, player_1]))
[['have', 'fun'], ['Just']]

The game argument is a game dictionary, like the one returned in Problem 9. You can access words in the game with the selector get_word, which takes in a game and the word_index (an integer). With get_word you can access the time it took any player to type any word using time.

Important: Be sure to use the game constructor when returning a game. The tests will check that you are using the game dictionary rather than assuming a particular data format.

Make sure your implementation does not mutate the given player input lists. For the example above, calling fastest_words on [player_0, player_1] should not mutate player_0 or player_1.

Before writing any code, unlock the tests to verify your understanding of the question:

$ python ok -q 10 -u

Once you are done unlocking, begin implementing your solution. You can check your correctness with:

$ python ok -q 10

Now you can play against other students in the course. Set enable_multiplayer to True near the bottom of cats.py and type swiftly!