CS 341 - Principles of Programming Languages
Homework #12 |
Due: at the beginning of class 25
Note: This work is to be done in pairs. Work will be reviewed during class 25. Although you may divide the work, both team members should be able to present/describe their partner's work upon request.
Create an object-oriented Python implementation of Pig according to this specification with a Keep Pace and End Race computer player rather than a Hold at 20 computer player. Since Python allows multiple inheritance, one would use an abstract base class (ABC) instead of an interface.
Keep Pace and End Race policy: Let i be the player's score, j be the opponent's score, and k be the current turn total. If i >= 71 or j >= 71, roll for the goal. Otherwise, hold at 21 + round((j - i) / 8). Call your computer player class KPERPigPlayer.
Common pitfalls: