Problem 10 (200pts)

注意:下载的代码中,Problem 10和 Problem 11的代码都包含一行assert False,这是因为hog_gui.py可能会调用这些函数,而调用没实现的代码可能会产生莫名其妙的错误。请在编写完自己的代码前将这行代码删除,不然你编写的代码会无法运行。

A strategy can try to take advantage of the Picky Piggy rule by rolling 0 when it is most beneficial to do so. Implement picky_strategy, which returns 0 whenever rolling 0 would give at least threshold points and returns num_rolls otherwise. This strategy should not also take into account the Swine Swap rule.

Hint: You can use the function picky_piggy you defined in Problem 2.

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

Once you have implemented this strategy, change run_experiments to evaluate your new strategy against the baseline. Is this strategy an improvement over the baseline?