Question: write code in python Heap of Beans Tournament Due October 22 at 11:59pm In this lab you wll be working to build a player (a

write code in pythonwrite code in python Heap of Beans Tournament Due October 22 at

Heap of Beans Tournament Due October 22 at 11:59pm In this lab you wll be working to build a player (a function that you write) to play Heap of Beans. This game is played with two players who take turns removing beans from a heap of beans on the table. Each player in tum is permitted to remove 1, 2, or 3 beans for a turn. The player who takes the last bean loses. Your goal is to write the best function (producing the largest number of wins) to play the part of one player in this game. Your function must be named player and expect one argument, the number of be ans currently remaining in the heap. It will return the number of beans (an integer) to be removed from the heap this turn. Its basic structure is like this Play "Heap of Beans". Use the best strategy you can devise to beat an opponent # 1 , 2, or 3 beans can be removed in a turn, but never more than the number of beans # currently on the table #@param beans-the number of beans currently on the table #@return-the number of beans to be removed this turn def player(be ans) Heap of Beans Tournament Due October 22 at 11:59pm In this lab you wll be working to build a player (a function that you write) to play Heap of Beans. This game is played with two players who take turns removing beans from a heap of beans on the table. Each player in tum is permitted to remove 1, 2, or 3 beans for a turn. The player who takes the last bean loses. Your goal is to write the best function (producing the largest number of wins) to play the part of one player in this game. Your function must be named player and expect one argument, the number of be ans currently remaining in the heap. It will return the number of beans (an integer) to be removed from the heap this turn. Its basic structure is like this Play "Heap of Beans". Use the best strategy you can devise to beat an opponent # 1 , 2, or 3 beans can be removed in a turn, but never more than the number of beans # currently on the table #@param beans-the number of beans currently on the table #@return-the number of beans to be removed this turn def player(be ans)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!