So I am trying to create a pig like game in python and I am trying to make a computer player I figured this code but can't seam to get it to make the rolls the number of times. So fore example I want to make it so if the computer rolls a 2 then I want it to roll again until the number of rolls gets to 10. I hope that made sense. So if the computer rolls a 6 then I want the computer to roll 3 times and add 1 until it gets to 10 and then pass back to you. Here is my code that I got so fare to test the AI.
import random
import sys
def bot():
dice = random.randint(1,6)
print("Computer rolled ")
print(dice)
rolls=dice+1
if rolls == 10:
sys.exit()
while 1:
bot()
Do I need to have another random roll statement fore the rolls? The dice is supposed to be fore the score.
1MeNca7h6m8du4TV3psN4m4X666p6Y36u5m