Main function
Description of Cases | Inputs | Expected Outputs / Actions |
---|---|---|
1. Normal play, ALL passes of both players used | P,P,P,P,P,P | first 6 turns, players totals should not change, pass counts reduce to zero, after 6 turns, rolls are automatically done without asking |
2. Normal play, NO passes used by either player | R,R,R,R,... | rolls are added to player's total accordingly |
3. Player 1 wins | R, ... | Player 2's total equals or exceeds 21 first |
4. Player 2 wins | R, ... | Player 1's total equals or exceeds 21 first |
Play_turn function
Description of Cases | Parameters, Inputs name, total rolls, passes, choice | Expected Outputs / Actions |
---|---|---|
Normal, player has 3 passes, uses one | "Joe", 5, 3, "P" | returns 5, 2 |
Normal, player has 3 passes, rolls | "Bob", 5, 3, "R", roll is 4 | returns 9, 3 |
Normal, player has 2 passes, uses one | "Joe", 0, 2, "P" | returns 0, 1 |
Normal, player has 2 passes, rolls | "Bob", 0, 2, "R", roll is 4 | returns 4, 2 |
Normal, player has 1 pass, uses it | "Sam", 5, 1, "P" | returns 5, 0 |
Normal, player has 1 pass, rolls | "Tom", 6, 1,"R", roll is 3 | returns 9, 1 |
Normal, player has no passes, rolls automatically | "Sue", 5, 0, no choice, rolls 3 | returns 8, 0 |
Pass or Roll function
Description of Cases | Parameter/Input | Expected Outputs / Actions |
---|---|---|
Normal input first | "Joe", "R" | prompt "Player Joe (P)ass or (R)oll", returns "R" |
Normal input first | "Joe", "r" | prompt "Player Joe (P)ass or (R)oll", returns "R" |
Normal input first | "Joe", "P" | prompt "Player Joe (P)ass or (R)oll", returns "P" |
Normal input first | "Joe", "p" | prompt "Player Joe (P)ass or (R)oll", returns "P" |
One invalid input, then valid | "Joe", "X","P" | gives error message, prompt "Player Joe (P)ass or (R)oll", returns "P" |
Two invalid inputs, then valid | "Joe","X","X","P" | gives error message, gives error message, prompt "Player Joe (P)ass or (R)oll", returns "P" |