Big Pig: Sample #1240

The human got a bit greedy and the computer won! Notice that when the human types in input that isn’t valid, they are prompted to enter their input again. You can have an error message if you’d like, but this example doesn’t have one.

$ python3 pig.py
* BIG PIG *

Welcome to Big Pig, the dice rolling game where players try to be the
first get 100 points! Players (you and the computer) will take turns
rolling two dice as many times as they want, adding all roll results to
a running total. Players lose their gained score for the turn if they
roll a 1.


--------------------------------------------------
Player has 0 and computer has 0
What do you want to do: [r]oll or [h]old? rool
What do you want to do: [r]oll or [h]old? hello
What do you want to do: [r]oll or [h]old? roll
human rolled [6, 4], current round score: 10
What do you want to do: [r]oll or [h]old? quit
What do you want to do: [r]oll or [h]old? roll
human rolled [3, 5], current round score: 18
What do you want to do: [r]oll or [h]old? hold me
What do you want to do: [r]oll or [h]old? h

--------------------------------------------------
Player has 18 and computer has 0
computer rolled [5, 5], current round score: 20
computer holds.

--------------------------------------------------
Player has 18 and computer has 20
What do you want to do: [r]oll or [h]old? roll
human rolled [1, 4], current round score: 0
Big pig!

--------------------------------------------------
Player has 18 and computer has 20
computer rolled [4, 3], current round score: 7
computer rolled [4, 1], current round score: 0
Big pig!

--------------------------------------------------
Player has 18 and computer has 20
What do you want to do: [r]oll or [h]old? roll
human rolled [3, 5], current round score: 8
What do you want to do: [r]oll or [h]old? roll
human rolled [6, 6], current round score: 32
What do you want to do: [r]oll or [h]old? roll
human rolled [4, 6], current round score: 42
What do you want to do: [r]oll or [h]old? roll
human rolled [1, 5], current round score: 0
Big pig!

--------------------------------------------------
Player has 18 and computer has 20
computer rolled [3, 4], current round score: 7
computer rolled [1, 1], current round score: 32
computer holds.

--------------------------------------------------
Player has 18 and computer has 52
What do you want to do: [r]oll or [h]old? roll
human rolled [2, 3], current round score: 5
What do you want to do: [r]oll or [h]old? roll
human rolled [5, 2], current round score: 12
What do you want to do: [r]oll or [h]old? roll
human rolled [3, 2], current round score: 17
What do you want to do: [r]oll or [h]old? roll
human rolled [3, 5], current round score: 25
What do you want to do: [r]oll or [h]old? roll
human rolled [5, 2], current round score: 32
What do you want to do: [r]oll or [h]old? roll
human rolled [1, 1], current round score: 57
What do you want to do: [r]oll or [h]old? roll
human rolled [1, 5], current round score: 0
Big pig!

--------------------------------------------------
Player has 18 and computer has 52
computer rolled [3, 1], current round score: 0
Big pig!

--------------------------------------------------
Player has 18 and computer has 52
What do you want to do: [r]oll or [h]old? roll
human rolled [2, 5], current round score: 7
What do you want to do: [r]oll or [h]old? roll
human rolled [1, 6], current round score: 0
Big pig!

--------------------------------------------------
Player has 18 and computer has 52
computer rolled [3, 3], current round score: 12
computer rolled [6, 5], current round score: 23
computer holds.

--------------------------------------------------
Player has 18 and computer has 75
What do you want to do: [r]oll or [h]old? roll
human rolled [5, 6], current round score: 11
What do you want to do: [r]oll or [h]old? roll
human rolled [4, 4], current round score: 27
What do you want to do: [r]oll or [h]old? roll
human rolled [1, 3], current round score: 0
Big pig!

--------------------------------------------------
Player has 18 and computer has 75
computer rolled [6, 6], current round score: 24
computer holds.

--------------------------------------------------
Player has 18 and computer has 99
What do you want to do: [r]oll or [h]old? roll
human rolled [3, 4], current round score: 7
What do you want to do: [r]oll or [h]old? roll
human rolled [4, 2], current round score: 13
What do you want to do: [r]oll or [h]old? roll
human rolled [3, 1], current round score: 0
Big pig!

--------------------------------------------------
Player has 18 and computer has 99
computer rolled [5, 2], current round score: 7
computer rolled [3, 6], current round score: 16
computer rolled [4, 5], current round score: 25
computer holds.
Computer wins [18, 124]!