Two-Dice Pig Example 1


$ python twodicepig.py

**** Two-Dice Pig v0.1 ****

  Let's play two-dice pig. Here are the rules:

  - to win you have to get to 100 (or above)
  - on your turn, roll the two dice repeatedly until either 
    a 1 is rolled, or you decide to 'hold'
  - if you decide to 'hold' your turn total is added to your game total
  - for the two rolled dice:
* if neither shows a 1, add their sum to your turn total
* if a single 1 is rolled, your turn ends and your turn total is zero
* if double-1's are rolled, your *game* total is reset to zero 
   (and your turn ends)
  
==========================================
Current Scores:   computer=  0    user=  0
==========================================

Roll(r),Hold(h),Quit(q): r
             >> ROLL: 4 1
             >> TURN: 0

******************** my turn!!!!
             >> ROLL: 6 1
Bleh...
==========================================
Current Scores:   computer=  0    user=  0
==========================================

Roll(r),Hold(h),Quit(q): r
             >> ROLL: 4 2
             >> TURN: 6

Roll(r),Hold(h),Quit(q): r
             >> ROLL: 4 2
             >> TURN: 12

Roll(r),Hold(h),Quit(q): h

******************** my turn!!!!
             >> ROLL: 2 1
Bleh...
==========================================
Current Scores:   computer=  0    user= 12
==========================================

Roll(r),Hold(h),Quit(q): r
             >> ROLL: 5 5
             >> TURN: 10

Roll(r),Hold(h),Quit(q): r
             >> ROLL: 5 2
             >> TURN: 17

Roll(r),Hold(h),Quit(q): h

******************** my turn!!!!
             >> ROLL: 5 2
             >> ROLL: 4 5
             >> ROLL: 3 3
I'll stick with that!
==========================================
Current Scores:   computer= 22    user= 29
==========================================

and so on...
==========================================
Current Scores:   computer= 22    user= 90
==========================================

Roll(r),Hold(h),Quit(q): r
             >> ROLL: 5 5
             >> TURN: 10

Roll(r),Hold(h),Quit(q): h

******************** my turn!!!!
             >> ROLL: 4 4
             >> ROLL: 1 5
Bleh...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
You win...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
==========================================
Current Scores:   computer= 22    user=100
==========================================
Return to Lab 07
Example 2
Example 3