Question: Problem 8 ( 1 pt ) . A strategy can also take advantage of the Swine swap rule. Implement which Rolls 0 if it would
Problem pt A strategy can also take advantage of the Swine swap rule. Implement
which
Rolls if it would cause a beneficial swap that gains points.
Rolls BASELINENUMROLLS if rolling would cause a harmful swap that loses points.
If rolling would not cause a swap, then do so if it would give at least points and roll BASELINENUMROLLS otherwise.
Test your implementation before moving on:
python hoggrader.py
Once you have implemented this strategy, update to evaluate your new strategy against the baseline. You should find that it performs even better than on average.
At this point, run the entire autograder to see if there are any tests that don't pass.
python hoggrader.pydef swapstrategyscore opponentscore:
mThis strategy rolls dice when it would result in a beneficial swap and rolls BASELINENUMROLLS if it would result in a harmful swap. It also rolls dice if that gives at least BACONMARGIN points and rolls BASELINENUMROLLS otherwise.
trategy #max : Beneficial swap
trategy #max : Harmful swap
trategy #max : Lots free bacon
trategy # Baseline
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
