Example #1
0
def project(array,choices):
    print "Projected scores on available choices: ",
    for c in choices:
        if choices[c]:
            print cl.Fore.GREEN+cl.Style.BRIGHT+c+": "+cl.Fore.RED+str(score.wrap(array,c))+cl.Fore.RESET+cl.Style.RESET_ALL,
    print "\n"
Example #2
0
    project(array,choices)
    redos = raw_input("\nWhich dices do you want to re-roll (last chance)?\nInput indices (start from 1) separated by space, press enter if you want to keep all of them: ").split()
    for r in redos:
        array[int(r)-1]=random.randint(1,6)
    print "\n\nYour dices are: ",
    for a in array:
        print cl.Fore.YELLOW+cl.Back.BLUE+cl.Style.BRIGHT+str(a)+cl.Fore.RESET+cl.Back.RESET+cl.Style.RESET_ALL,
    print "\n"
    project(array,choices)
    choice = raw_input("\nPlease make a choice from the available choices: ")
    try:
        while not choices[choice]:
            choice = raw_input("You've already used that one before. Please try again: ")
    except:
        choice = raw_input("That one does not exist. Please try again: ")
    scores[choice]=score.wrap(array,choice)
    print "\nYou chose "+cl.Fore.GREEN+cl.Style.BRIGHT+choice+cl.Fore.RESET+cl.Style.RESET_ALL+" and scored "+cl.Fore.RED+cl.Style.BRIGHT+str(scores[choice])+cl.Fore.RESET+cl.Style.RESET_ALL+" in "+cl.Fore.YELLOW+cl.Style.BRIGHT+"round #"+str(13-rounds_left+1)+cl.Fore.RESET+cl.Style.RESET_ALL+"!\n"
    choices[choice] = False
    calc(scores)
    print "Scores: ",
    for s in scores:
        if s != 'UPPER_BONUS' and s != 'TOTAL':
            if not choices[s]:
                print cl.Fore.CYAN+cl.Style.BRIGHT+s+"  "+cl.Fore.MAGENTA+str(scores[s])+cl.Fore.RESET+cl.Style.RESET_ALL,
        else:
            print cl.Fore.CYAN+cl.Style.BRIGHT+s+"  "+cl.Fore.MAGENTA+str(scores[s])+cl.Fore.RESET+cl.Style.RESET_ALL,
    print ""
    rounds_left -= 1

print cl.Fore.BLUE+cl.Style.BRIGHT+"\nCongratulations! You've finished the Yahtzee game and scored a total of ",
print cl.Fore.RED+str(scores['TOTAL']),