Ejemplo n.º 1
0
def roll_die():  #function to create die value
    """
    Creates a random integer given in cse231_random
    Assigns value to a die
    Returns value from 1 to 6 (int)
    """
    die_value = randint(1, 6)  #create random integer from cse231_random
    return die_value  #returns die value created
Ejemplo n.º 2
0
def roll_die():
    '''Rolls one die. This function 
        should randomly 
        generate a value between 1 and 6
        inclusively and returns that value as an int'''

    random = randint(1, 6)

    return random
Ejemplo n.º 3
0
    def __init__(self,
                 name='fluffy',
                 species='dog',
                 gender='male',
                 color='white'):
        # Initial a pet with name,species,gender and color.
        # modify the following code
        self._name = name.capitalize()
        self._species = species.capitalize()
        self._gender = gender.capitalize()
        self._color = color.capitalize()
        self._edible_items = []
        self._drinkable_items = []

        self._hunger = randint(0, 5)
        self._thirst = randint(0, 5)
        self._smell = randint(0, 5)
        self._loneliness = randint(0, 5)
        self._energy = randint(5, 10)

        self._reply_to_master('newborn')
Ejemplo n.º 4
0
    def __init__(self,
                 name='fluffy',
                 species='dog',
                 gender='male',
                 color='white'):
        # insert docstring

        self._name = name.capitalize()
        self._species = species.capitalize()
        self._gender = gender.capitalize()
        self._color = color.capitalize()
        self._edible_items = ''
        self._drinkable_items = ''

        self._hunger = randint(0, 5)
        self._thirst = randint(0, 5)
        self._smell = randint(0, 5)
        self._loneliness = randint(0, 5)
        self._energy = randint(5, 10)

        self._reply_to_master('newborn')
Ejemplo n.º 5
0
    def __init__(self,
                 name='fluffy',
                 species='dog',
                 gender='male',
                 color='white'):
        '''method initializes the variables that were input, or if none were input,\
        initializes the default variables'''

        self._name = name.capitalize()
        self._species = species.capitalize()
        self._gender = gender.capitalize()
        self._color = color.capitalize()
        self._edible_items = []
        self._drinkable_items = []

        self._hunger = randint(0, 5)
        self._thirst = randint(0, 5)
        self._smell = randint(0, 5)
        self._loneliness = randint(0, 5)
        self._energy = randint(5, 10)

        self._reply_to_master('newborn')
Ejemplo n.º 6
0
    def __init__(self, name='fluffy', species='dog', gender='male',color='white'):
        '''
        This method is responsible for the creation of the object from the class pet
        that at its default is a dog called fluffy, of male gender and has white fur
        In this method the the specificatios for the values of hunger
        thirst, smell , loneliness, energy and initial response 'newborn' are set.
        '''
        # modify the following code
        
        self._name = name.capitalize()
        self._species = species.capitalize()
        self._gender = gender.capitalize()
        self._color = color.capitalize()
        self._edible_items = hunger_lst   
        self._drinkable_items = drink_lst 

        self._hunger = randint(0,5)
        self._thirst =randint(0,5)
        self._smell = randint(0,5)
        self._loneliness = randint(0,5)
        self._energy = randint(5,10)

        self._reply_to_master('newborn')
Ejemplo n.º 7
0
    def __init__(self,
                 name='fluffy',
                 species='dog',
                 gender='male',
                 color='white'):
        '''
        This function will initialize different values like name, species, gender, color, etc..
        '''
        # These next couple lines will initialize different values
        self._name = name.capitalize()
        self._species = species.capitalize()
        self._gender = gender.capitalize()
        self._color = color.capitalize()
        self._edible_items = []
        self._drinkable_items = []

        self._hunger = randint(0, 5)
        self._thirst = randint(0, 5)
        self._smell = randint(0, 5)
        self._loneliness = randint(0, 5)
        self._energy = randint(5, 10)

        self._reply_to_master('newborn')
Ejemplo n.º 8
0
    # if user choses to quit
    if Level == "Q" or Level == "q":
        break

    # if user choses easy
    elif Level == "E" or Level == "":
        total_score = 0
        games += 1
        i = 0
        str = ""
        t = 10

        # loop to conduct 10 games
        for n in range(0, 10):
            length = randint(3, 5)

            # loop to generate random string
            for i in range(length):
                Index = randint(0, len(ALPHABET_EASY) - 1)
                char = ALPHABET_EASY[Index]
                str += char
            print("Level [{}], game [{}]/[10]\n".format(Level, games))
            t1 = time.time()
            print("Enter this string: {}".format(str))
            str_input = input(" ")
            str_input = str_input.replace(" ", "")
            t2 = time.time()

            # if there are spaces or it entered string is the wrong case
            if str_input == str.upper() or str_input == str.lower():
Ejemplo n.º 9
0
def roll_die():
    '''Insert docstring here.'''
    die = randint(1, 6)
    return die
Ejemplo n.º 10
0
def roll_die():
    '''rolls random number 1-6 and assigns numbers to dice'''
    die2_value = randint(1, 6)
    return die2_value