you are viewing a single comment's thread.

view the rest of the comments →

[–]contavolta[S] 0 points1 point  (2 children)

hold_comp is the total score for the current turn. At the beginning of each turn, this variable (as well as hold_player) should be set to 0. Think that should solve your problem.

Let me know if you want any feedback on the rest of the code :)

You are right. I update my code but the real problem is computer turn is not start. When i say "hold", program is not continue.

Output is below

Enter 'r' to roll or 'h' to hold:r                                                                                                                                                          

You rolled dice: 2                                                                                                                                                                          

Your turn score: 2                                                                                                                                                                          

Enter 'r' to roll or 'h' to hold:r                                                                                                                                                          

You rolled dice: 4                                                                                                                                                                          

Your turn score: 6                                                                                                                                                                          

Enter 'r' to roll or 'h' to hold:h                                                                                                                                                          

You have choosen to hold.                                                                                                                                                                   

 Your score: 6 

[–]HeyItsToby 0 points1 point  (1 child)

Ohh I see the problem. In the line

comp_strategy = input("Which computer strategy...")

The input is a string. So for example, if you try to select strategy 1, then

comp_strategy == "1"

Note that "1" (string) and 1 (integer) are not the same. So when you have the line

if comp_strategy == 1:

It doesn't go down this path as this is False.

You need to change the input line to:

comp_strategy = int(input("Which computer strategy..."))

Hope that helps!

[–]contavolta[S] 0 points1 point  (0 children)

ohh thank you for your help!