python_data_scien/poc1/min_porj_4(Yahtzee).py
def strategy(hand, num_die_sides):
    """
    Compute the hold that maximizes the expected value when the
    discarded dice are rolled.

    hand: full yahtzee hand
    num_die_sides: number of sides on each die

    Returns a tuple where the first element is the expected score and
    the second element is a tuple of the dice to hold
    """
    all_possible_holds_set = gen_all_holds(hand)
    all_possible_holds_list = list(all_possible_holds_set)
    #print 'all_possible_holds_list:',all_possible_holds_list
    max_e_v = 0.0
    for idx in range(len(all_possible_holds_list)):
        i_tuple = all_possible_holds_list[idx]
        held_dice = i_tuple
        num_free_dice = len(hand) - len(i_tuple)
        e_v = expected_value(held_dice, num_die_sides, num_free_dice)
        if idx == 0:
            max_e_v = e_v
            best_held_tuple = i_tuple
        else:
            if e_v > max_e_v:
                max_e_v = e_v
                best_held_tuple = i_tuple 
                   
    return (max_e_v, best_held_tuple)

    Compute the hold that maximizes the expected value when the
    discarded dice are rolled.

    hand: full yahtzee hand
    num_die_sides: number of sides on each die

    Returns a tuple where the first element is the expected score and
    the second element is a tuple of the dice to hold
    
Compute the hold that maximizes the expected value when the
discarded dice are rolled.

full yahtzee hand
num_die_sides: number of sides on each die

Returns a tuple where the first element is the expected score and
the second element is a tuple of the dice to hold
Compute the hold that maximizes the expected value when the discarded dice are rolled . full yahtzee hand num_die_sides : number of sides on each die Returns a tuple where the first element is the expected score and the second element is a tuple of the dice to hold
def strategy(hand, num_die_sides):
    all_possible_holds_set = gen_all_holds(hand)
    all_possible_holds_list = list(all_possible_holds_set)
    max_e_v = 0.0
    for idx in range(len(all_possible_holds_list)):
        i_tuple = all_possible_holds_list[idx]
        held_dice = i_tuple
        num_free_dice = len(hand) - len(i_tuple)
        e_v = expected_value(held_dice, num_die_sides, num_free_dice)
        if idx == 0:
            max_e_v = e_v
            best_held_tuple = i_tuple
        else:
            if e_v > max_e_v:
                max_e_v = e_v
                best_held_tuple = i_tuple 
    return (max_e_v, best_held_tuple)
def strategy ( hand , num_die_sides ) : all_possible_holds_set = gen_all_holds ( hand ) all_possible_holds_list = list ( all_possible_holds_set ) max_e_v = 0.0 for idx in range ( len ( all_possible_holds_list ) ) : i_tuple = all_possible_holds_list [ idx ] held_dice = i_tuple num_free_dice = len ( hand ) - len ( i_tuple ) e_v = expected_value ( held_dice , num_die_sides , num_free_dice ) if idx == 0 : max_e_v = e_v best_held_tuple = i_tuple else : if e_v > max_e_v : max_e_v = e_v best_held_tuple = i_tuple return ( max_e_v , best_held_tuple )
Compute the hold that maximizes the expected value when the
discarded dice are rolled.
Compute the hold that maximizes the expected value when the discarded dice are rolled .
"""
    Compute the hold that maximizes the expected value when the
    discarded dice are rolled.

    hand: full yahtzee hand
    num_die_sides: number of sides on each die

    Returns a tuple where the first element is the expected score and
    the second element is a tuple of the dice to hold
    """ #print 'all_possible_holds_list:',all_possible_holds_list

hand
num_die_sides