def __init__(self, lvl, armour): nameObject = Name.Name("goblin") verbose = True allEdges = edgeLibrary.edgeLibrary() allHindrances = hindranceLibrary.hindranceLibrary() impair = {'smarts':1} skillString = {"boating": "agility", "climbing": "strength", "fighting": "agility", "healing": "smarts", "intimidate": "spirit", "lockpicking": "agility", "notice": "smarts", "persuasion": "spirit", "repair": "smarts", "shooting": "agility", "stealth": "agility", "survival":"smarts", "swimming":"agility", "throwing":"agility", "tracking":"smarts", "taunt": "smarts", "use magic item": "smarts"} super(Goblin, self).__init__(lvl,armour, nameObject, verbose, allEdges, allHindrances, impair, skillString)
def CreateRandomGame(db): if isinstance(db, AVL_Tree): # we want the players of our DB d = db.InOrder_List(db.root) else: d = db if len(d) < 10: print("Not enough Players in DB to create a game") else: #Create the set to select random Players s = set() n = len(d) - 1 while len(s) < 10: # Random selection i = random.randint(0, n) #Because s is a set #->no int doublons s.add(i) temp = list() for element in s: #then we create our list of players temp.append(d[element]) name = Name.generate_word(6) #generate a random name game = Game(name, temp) return game
def __init__(self, dataSet): self.dataSet = dataSet self.cardType = CardType.createType(self.generateList('type'), self.model) self.cardTypes = CardTypes.createTypes(self.generateList('types'), self.model) self.cmc = Cmc.createCmc(self.generateList('cmc'), self.model) self.colorIdentity = ColorIdentity.createColorIdentity(self.generateList('colorIdentity'), self.model) self.colors = Colors.createColors(self.generateList('colors'), self.model) self.hand = Hand.createHand(self.generateList('hand'), self.model) self.imageName = ImageName.createImageName(self.generateList('imageName'), self.model) self.layouts = Layouts.createLayouts(self.generateList('layout'), self.model) self.legalities = Legalities.createLegalities(self.generateList('legalities'), self.model) self.life = Life.createLife(self.generateList('life'), self.model) self.loyalty = Loyalty.createLoyalty(self.generateList('loyalty'), self.model) self.manaCost = ManaCost.createManaCost(self.generateList('manaCost'), self.model) self.name = Name.createName(self.generateList('name'), self.model) self.names = Names.createNames(self.generateList('names'), self.model) self.power = Power.createPower(self.generateList('power'), self.model) self.printings = Printings.createPrintings(self.generateList('printings'), self.model) self.rulings = Rulings.createRulings(self.generateList('rulings'), self.model) self.source = Source.createSource(self.generateList('source'), self.model) self.starter = Starter.createStarter(self.generateList('starter'), self.model) self.cardSubTypes = CardSubTypes.createSubTypes(self.generateList('subtypes'), self.model) self.cardSuperTypes = CardSuperTypes.createSuperTypes(self.generateList('supertypes'), self.model) self.text = Text.createText(self.generateList('text'), self.model) self.toughness = Toughness.createToughness(self.generateList('toughness'), self.model)
def __init__(self, periodicity=30): # 30 seconds self._periodicity = periodicity self._subscribers = {} self._currentPrefix = Name() self._needStopDiscovery = True self._scheduler = Scheduler() self._scheduler.start() self._timeouts = 0 self._face = Face() self._eventLoop = Face.EventLoop(self._face)
def __init__(self, gender): self.unitID = Unit.nextID Unit.nextID += 1 self._faction = 0 self._level = 0 self._class = None self._gender = gender self._name = Name.random(self._gender) self._abilities = {} self._classLevels = {} # Main stats self._mhp = 0 self._msp = 0 self._watk = 0 self._wdef = 0 self._matk = 0 self._mdef = 0 self._speed = 0 # Growth mods - set randomly when character is created self._mhpGrowthMod = 0 self._mspGrowthMod = 0 self._watkGrowthMod = 0 self._wdefGrowthMod = 0 self._matkGrowthMod = 0 self._mdefGrowthMod = 0 self._speedGrowthMod = 0 # Temp stats used for battles self._x = 0 self._y = 0 self._z = 0 self._hp = 0 self._sp = 0 self._ct = 0 self._hasMove = False self._hasCancel = False self._hasAct = False self._alive = False self._facing = Constants.N self._defenders = [] self._defending = [] # List of sprites self._spriteRoot = None # Set by Resources (FIXME) self._sprites = None self._overSprites = None self._weapon = Resources.equipment(Equipment.WEAPON, "hands") self._armor = None self._statusEffects = StatusEffects()
def start(self): self.handle.setInterestFilter(self.name, self) interest = Interest.Interest( name = Name.Name(self.name)) interest.name += '\xC1.R.sw' interest.name.appendNonce() print("Expressing interest: ndn:%s" % interest.name) self.handle.expressInterest(interest.name, self, interest) self.handle.run(-1)
def CreateRankingGame(db, rank, name=None): if isinstance(db, AVL_Tree): d = db.InOrder_List(db.root) else: d = db ranks = GetRanks( d) # get the posssible ranks for the db considering its state # with the players corresponding #list of players for the given rank players = ranks[rank] #create the game if name == None: name = Name.generate_word(6) game = Game(name, players, rank) return game
def main(): POPULATION_SIZE = 40 generation = 1 population = [None for i in range(POPULATION_SIZE)] for i in range(POPULATION_SIZE): population[i] = Name.Name("hello world") while True: create = ApplyGA.ApplyGa(population, mutation=0.2) population = create.newGen() generation += 1 for each in population: print(each.prediction) if "hello world" in each.prediction: print(generation) return print(generation)
def _onLocalPrefix(self, baseName, interest, data, kind): try: name = Name(str(data.content).strip(' \t\n\r')) except: pass if (name != self._currentPrefix): for subscriber in self._subscribers.values(): subscriber(self._currentPrefix, name) self._currentPrefix = name if not self._needStopDiscovery: nextDiscovery = datetime.datetime.now() + datetime.timedelta( seconds=self._periodicity) self._scheduler.add_date_job(self._requestLocalPrefix, nextDiscovery) return Closure.RESULT_OK
def _onTimeout(self, baseName, interest): if self._timeouts < 3: self._timeouts = self._timeouts + 1 return Closure.RESULT_REEXPRESS else: # do stuff name = Name() if (name != self._currentPrefix): for subscriber in self._subscribers.values(): subscriber(self._currentPrefix, name) self._currentPrefix = name if not self._needStopDiscovery: nextDiscovery = datetime.datetime.now() + datetime.timedelta( seconds=self._periodicity) self._scheduler.add_date_job(self._requestLocalPrefix, nextDiscovery) return Closure.RESULT_OK
"""Another client of the Name class.""" from Name import * # Create a Name object. hopper: Name = Name("Grace", "Brewster Murray", "Hopper") # Invoke Name method. print(hopper.get_first_last_name())
def __init__(self, fname, lname, street, zip, city, state, contact_number): self._name = name.Name(fname, lname) self._address = addr.Address(street, zip, city, state) self._contact_number = contact_number
def _requestLocalPrefix(self): self._timeouts = 0 self._face.expressInterestForLatest(Name("/local/ndn/prefix"), self._onLocalPrefix, self._onTimeout)
## Main class for the Name class ## Tests methods and modularity ## ## Completed By: Robert Lowman ## Date: 12/1/2016 import Name aName = Name.Name("John", "Paul", "Jones") assert aName.first == "John", "Invalid first" assert aName.middle == "Paul", "Invalid middle" assert aName.last == "Jones", "Invalid last" assert aName.fullName() == "John Paul Jones", "Invalid full" aName.printName() print "All tests passed!"
def test_Equal(self): self.assertMultiLineEqual(Name.name("John", "Phillip"), "John Phillip")
def test_NotNone(self): self.assertIsNotNone(Name.name("Dylan", "Matthew"))
app_id = row['ID'] address = row['Address'] open_paren_index = original_name.find('(') if open_paren_index != -1 and original_name[0:open_paren_index].lower().find('trustee') == -1: name = original_name[:open_paren_index] # extracted_names.append(name_sub_a) else: name = replace_ampersand(original_name) name = get_substring_of_trust_title(original_name) doc = nlp(name) for ent in doc.ents: if ent.label_ == 'PERSON' and ent.text.lower().find('successor') == -1: if ent.text.lower().endswith('trust'): stripped_name = get_name(ent.text) name_obj = Name.Name(stripped_name, True) last_names.append(name_obj.last_name) first_names.append(name_obj.first_name) middle_names.append(name_obj.middle_name) app_ids.append(app_id) lead_addresses.append(address) original_names.append(original_name) org_names.append('') # names = names + stripped_name + ' - ' else: # names = names + ent.text + ' - ' name_obj = Name.Name(ent.text, True) last_names.append(name_obj.last_name) first_names.append(name_obj.first_name)
def __init__(self, handle, name, content): self.handle = handle self.name = Name.Name(name) self.content_objects = content
def RandomizeLastRound(self): if len(self.Players) != 0: for element in self.Players: element.val += (Name.generate_int() + Name.generate_int() + Name.generate_int() + Name.generate_int() + Name.generate_int()) / 5.0
"""Demonstrate using the Name class.""" from Name import * # Create a Name object. turing: Name = Name("Alan", "Mathison", "Turing") # Invoke Name methods. print(turing.get_full_name()) print(turing.get_initial_name())
from random import random,randint import Name as fill #words =fill.get_csv_list('wordlist.csv') articles=["The","A","One","No"] #adjectives=["blue","red","big","yellow","tall","small","smelly"] #nouns=["desk","car","girl","boy","chair","laptop"] #verbs=["eats","sleeps","works", "jumps","swims","plays"] #DO=["soccer","food","bed","pool"] #adverbs=["quickly","slowly","rapidly"] #adjectives = words[2] #nouns = words[0] #verbs = words[1] #DO = words[0] #adverbs = words[3] words= fill.get_csv_dict('wordlist.csv') nouns=words['nouns'] verbs=words['verbs'] adjectives=words['adjectives'] adverbs=words['adverbs'] DO=words['nouns'] def OneOf(k): return k[int(random()*len(k))] def pick1(k): ran= randint(0,1) if ran == 0: return '' if ran == 1: return OneOf(k)
import pygame, player, socket, bullet, Name s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) ip = "127.0.0.1" #input("enete number:")#ip address name = Name.name("Enter Your Name:")[16:] #input("Enter Your Name:") name = name + " " * (8 - len(name)) port = 5005 pygame.init() pygame.font.init() screen_x = 800 screen_y = 400 car_x = 50 car_y = 50 fire = 0 enemy_y = 50 playingi1 = 0 healthbar_x = 100 healthbar_y = 10 screen = pygame.display.set_mode((screen_x, screen_y)) backgroundimage = pygame.image.load("background.png") backgroundimage = pygame.transform.scale(backgroundimage, (screen_x, screen_y)) car = pygame.image.load("hero.png") car1 = pygame.image.load("enemy.png") car = pygame.transform.scale(car, (car_x, car_y)) car.convert_alpha() car.set_colorkey((255, 255, 255)) car1 = pygame.transform.scale(car1, (car_x, car_y)) car1.convert_alpha() car1.set_colorkey((255, 255, 255)) bulletimage = pygame.image.load("bullet1.png") bulletimage = pygame.transform.scale(bulletimage, (20, 10)) bulletimage.convert_alpha()
import Name Name.TT() import random x = random.randrange(1, 1000) print(x)
def test_NotEqual(self): self.assertMultiLineEqual(Name.name("Collette", "Adele"), "ColletteAdele")