def create_hero(): n = int(input("z ilu liter zbudować imię")) name = ig.generate_name(n) person = {'name': '', 'character type': [], 'equipment': [], 'money': 100, 'health': 100, 'stamina': 100 } sex = ['male', 'female'] race = ['human', 'dwarf', 'elf'] equipment = ['sword', 'shovel', 'axe', 'bow', 'bow', 'shield', 'helmet', 'armour', 'wand', 'hammer'] player = [] player_equipment = [] for i in sex: print(i) select_sex = input("Wybierz płeć") player.append(select_sex) for i in race: print(i) select_race = input("wybierz rasę") player.append(select_race) for i in range(4): player_equipment.append(random.choice(equipment)) person['character type'] = player person['equipment'] = player_equipment person['name'] = name return person
def generate(): name = generate_name("XXXX") price = rand_range_f(min_price, max_price) monthly_yield = rand_range_f(0, max_monthly_yield) default_probability = rand_range_f(min_default_probability, max_default_probability) volatility = rand_range_f(min_volatility, max_volatility) return Stock(name, price, monthly_yield, default_probability, volatility)
def generate(): name = generate_name("xxxxx") price = rand_range_f(min_price, max_price) monthly_yield = rand_range_f(0, max_monthly_yield) default_probability = rand_range_f(min_default_probability, max_default_probability) months_to_maturity = random.randint(min_months_to_maturity, max_months_to_maturity) return Bond(name, price, monthly_yield, default_probability, months_to_maturity)
def home(request): weights = [1,3,5,7,10] candidate_name = name_generator.generate_name(weights, unigram_counts, bigram_counts, trigram_counts, fourgram_counts, fivegram_counts) template = loader.get_template('name_gen.html') context = RequestContext(request, { 'candidate_name': candidate_name, }) return HttpResponse(template.render(context))
- Przygody są zdefiniowanymi zdaniami, które będą losowo wypełniane odpowiednimi wyrazami, np: "(bohater) poszedł do (miejsce) aby (czasownik). " może stać się "Jouxdrien II Niemrawy poszedł do tawerny aby zasnąć." - Historyjka ma mieć zadaną długość i ma być możliwie losowa.""" import name_generator as ng import random def place_choice(name): for i in miejsca: print("--", i) place = input("Wybierz cel swojej wędrówki") if place in miejsca: print("Witaj w {} {}".format(place, name)) else: print("Zły wybór. Porwano cię i uwięziono w lochu") bohater = { "ruch": ["idź do", "skocz na", "wyjdź z", "zasnął z"], "walka": ["uderzył kijem", "ciął toporem", "pchnął mieczem"], "dialog": ["nie słucham tych głupot", "zabiję cię"] } miejsca = ["gospoda", "cmentarz", "klasztor"] numbers = int(input("enter the number of characters")) a = ng.generate_name(numbers) print("Twój bohater to:", a) place_choice(a)