def SemiNDSi(siSkill,dummySkill,delay,on,attackSpeed): Terminal.SetCheckBox("Auto Attack",False) Terminal.SetRadioButton("SIRadioMelee",True) Terminal.SetCheckBox("MonkeySpiritsNDcheck",False) count = 0 if siSkill != 32120055: delay = 30*math.ceil(delay*1000 * (10+attackSpeed)/480)/1000 print("The delay for skill {} is {}, starting si".format(siSkill,delay)) if siSkill in [5311000,5301000]: sleepTime = 0.161 elif siSkill not in [25101000,25121000]: sleepTime = 0.211 else: sleepTime = 0.101 while Field.GetCharacterCount()<=1 and Field.GetEliteState() !=2 and len(Field.GetMobs())>0 and not Terminal.IsRushing() and GameState.IsInGame() and not Terminal.GetRadioButton("SIRadioDragon") and on: Terminal.SetCheckBox("Skill Injection",True) Terminal.SetLineEdit("SISkillID",str(siSkill)) Terminal.SetCheckBox("Melee No Delay",True) Terminal.SetSpinBox("SkillInjection",17) time.sleep(sleepTime) #Terminal.SetCheckBox("Melee No Delay",False) Terminal.SetLineEdit("SISkillID",str(dummySkill)) time.sleep(0.043) Terminal.SetCheckBox("Skill Injection",False) time.sleep(delay+0.05) #if Terminal.IsRushing(): # break if (siSkill == 27111303 or siSkill == 27121303) and not(Character.HasBuff(2,20040220) or Character.HasBuff(2,20040219)): break count += 1 print("Si ended due to break options")
def __init__(self, name, parent): super(WSP, self).__init__(name, parent) self.myFields[Names.WSP["WSPTID"]] = Field.Field(Names.WSP["WSPTID"], self) self.myFields[Names.WSP["WSPTYPE"]] = Field.Field(Names.WSP["WSPTYPE"], self) self.myFields[Names.WSP["WSPHL"]] = Field.Field(Names.WSP["WSPHL"], self, self.encodeWSPHL) self.myFields[Names.WSP["WSPCONTTYPE"]] = Field.Field(Names.WSP["WSPCONTTYPE"], self, self.encodeDecode) self.myFields[Names.WSP["WSPHDRS"]] = Field.Field(Names.WSP["WSPHDRS"], self, self.encodeDecode)
def readExcelInfo(self, inFile): xl = ReaderExcelCore(inFile) sheetnames = xl.worksheets() # print sheetnames for sheet in sheetnames: if sheet == 'input': klassName = '' oldKlassEng = '' for row in xl.getIter(sheet, True): # Klass_Name, Field_Name, Field_Datatype, Field_Null_Option, Field_Is_PK, Field_Is_FK, Attribute_Name, Entity_Name, SEQ_NO try: #번호 클래스명 가시성 타입 속성명 seqNo, klassName, fieldVisibility, fieldType, fieldName = row[0:5] except (ValueError): print 'excel input file is invalid' print '엑셀 파일에 문제가 있습니다. 열의 개수가 너무 많습니다.' sys.exit(2) if seqNo == 'NO': continue if fieldName == '': break if oldKlassEng != klassName: aKlass = Klass() aKlass.setAttributes(klassName) self.klassListFromExcel.append(aKlass) oldKlassEng = klassName if len(fieldName) > 0: aField = Field() aField.setAttributes(fieldVisibility, fieldType, fieldName) aKlass.addFieldList(aField) return self.klassListFromExcel
def GetIngredient(self, amount): curAmount = 0 firstAmount = SunCat.GetChuChu() while curAmount < amount: if Field.GetID() not in hungryMutoMaps or GameState.IsInGame( ) == False: break curAmount = SunCat.GetChuChu() if curAmount == firstAmount: curAmount = 0 curDrop = self.GetDrop() if curDrop is not None: if self.name == "Slurpy Fruit": while self.GetDrop() is not None: if Field.GetID( ) not in hungryMutoMaps or GameState.IsInGame( ) == False: break SunCat.KamiTP(curDrop.x, curDrop.y) Character.LootItem() time.sleep(0.1) else: SunCat.KamiTP(curDrop.x, curDrop.y) Character.LootItem() else: curMob = self.GetMob() if curMob is not None: SunCat.KamiTP(curMob.x + kamiOffsetX, curMob.y + kamiOffsetY) time.sleep(0.1) self.HandIn()
def startChuChu(): if Field.GetID() != ccStartingMap: SCLib.UpdateVar("CurStep", "InitChuChu") else: retryCount = SCLib.GetVar("RetryCount") if retryCount > 3: SCLib.UpdateVar("RetryCount", 0) print("Finished ChuChu") SCLib.UpdateVar("CurStep", "FinishedChuChu") SunCat.UnhookChuChu() else: Npc.ClearSelection() Npc.RegisterSelection("Enter <Hungry Muto>") if chuChuHardMode: Npc.RegisterSelection("Hard") else: Npc.RegisterSelection("Normal") Character.TalkToNpc(ccNpc) time.sleep(5) if Field.GetID() == ccStartingMap: print("Failed to enter ChuChu, creating a new party...") leaveParty() createParty() SCLib.UpdateVar("RetryCount", retryCount + 1) time.sleep(1) elif Field.GetID() in hungryMutoMaps: print("Starting ChuChuPQ!") SCLib.UpdateVar("CurStep", "DoingChuChu")
def BossCheck(): print("Waiting for boss to spawn...") time.sleep(10) for mob in boss: print("Checking for boss: " + str(mob) + "...") while Field.FindMob(mob).valid and GameState.IsInGame(): print("Boss found: " + str(mob) + ", killing boss...") time.sleep(6) for item in eqp: print("Checking for item: " + str(item) + "...") while Field.FindItem(item).valid and GameState.IsInGame(): #Terminal.SetCheckBox("Kami Vac",False) print("item found with id:" + str(item) + ", waiting until item looted") time.sleep(9) for mob in boss: print("Checking for boss: " + str(mob) + "...") while Field.FindMob(mob).valid and GameState.IsInGame(): print("Boss found: " + str(mob) + ", killing boss...") time.sleep(6) for item in eqp: print("Checking for item: " + str(item) + "...") while Field.FindItem(item).valid and GameState.IsInGame(): #Terminal.SetCheckBox("Kami Vac",False) print("item found with id:" + str(item) + ", waiting until item looted") time.sleep(9) print("no boss found or boss killed") time.sleep(6)
def __init__(self, name, parent): super(RPDU, self).__init__(name, parent) self.myFields[Names.RPDU["RPDUMTI"]] = Field.Field( Names.RPDU["RPDUMTI"], self) self.myFields[Names.RPDU["RPDUMR"]] = Field.Field( Names.RPDU["RPDUMR"], self) RPOA = OrderedField.OrderedField( Names.RPDU["RPOA"], self, "", [Names.RPDU["RPOALEN"], Names.RPDU["RPOANO"]]) RPOA.myFields[Names.RPDU["RPOALEN"]] = Field.Field( Names.RPDU["RPOALEN"], RPOA, self.encodeRPOALength) RPOA.myFields[Names.RPDU["RPOANO"]] = Field.Field( Names.RPDU["RPOANO"], RPOA, self.encodeDecode) self.myFields[Names.RPDU["RPOA"]] = RPOA RPDA = OrderedField.OrderedField( Names.RPDU["RPDA"], self, "", [Names.RPDU["RPDALEN"], Names.RPDU["RPDANO"]]) RPDA.myFields[Names.RPDU["RPDALEN"]] = Field.Field( Names.RPDU["RPDALEN"], RPDA, self.encodeRPDALength) RPDA.myFields[Names.RPDU["RPDANO"]] = Field.Field( Names.RPDU["RPDANO"], RPDA, self.encodeDecode) self.myFields[Names.RPDU["RPDA"]] = RPDA self.myFields[Names.RPDU["RPUDL"]] = Field.Field( Names.RPDU["RPUDL"], self, self.encodeRPUDL) self.myFields[Names.RPDU["RPUDTYPE"]] = Field.Field( Names.RPDU["RPUDTYPE"], self) self.myFields[Names.RPDU["RPCAUSELEN"]] = Field.Field( Names.RPDU["RPCAUSELEN"], self, self.encodeRPCauseLength) self.myFields[Names.RPDU["RPCAUSE"]] = Field.Field( Names.RPDU["RPCAUSE"], self)
def ToPortal(portal, enter=True): map = Field.GetID() portal = Field.FindPortal(portal) if portal.valid: AAFlag = False kamiFlag = False if Terminal.GetCheckBox("Auto Attack"): AAFlag = True CheckBox("Auto Attack", False) if Terminal.GetCheckBox("Kami Vac"): kamiFlag = True CheckBox("Kami Vac", False) time.sleep(1) if not (Character.GetPos().x < portal.x + 5 and Character.GetPos().x > portal.x - 5): Character.Teleport(portal.x, portal.y - 20) time.sleep(1) attempt = 0 while enter and Field.GetID() == map and attempt < 3: attempt += 1 Character.EnterPortal() time.sleep(1) if AAFlag: CheckBox("Auto Attack", True) if kamiFlag: CheckBox("Kami Vac", True)
def update(self, fieldnames, varname, value): newfieldnames = "" IEname = "" if fieldnames == "": pass else: if Names.UD["IE"] in fieldnames: IEname = Names.UD["IE"] + "%d" % (self.IEcount) newfieldnames = fieldnames newfieldnames.pop(0) newfieldnames = [IEname] + newfieldnames if Names.UD["IELEN"] in fieldnames: if Names.Common["NEEDSENCODING"] == varname: self.IEcount += 1 IEname = Names.UD["IE"] + "%d" % (self.IEcount) self.currIE = OrderedField.OrderedField( IEname, self, "", [ Names.UD["IETYPE"], Names.UD["IELEN"], Names.UD["IEDATA"] ]) self.currIE.myFields[Names.UD["IELEN"]] = Field.Field( Names.UD["IELEN"], self.currIE, self.encodeIELEN) self.currIE.myFields[Names.UD["IETYPE"]] = Field.Field( Names.UD["IETYPE"], self.currIE) self.currIE.myFields[Names.UD["IEDATA"]] = Field.Field( Names.UD["IEDATA"], self.currIE, self.encodeDecode) self.myFields[IEname] = self.currIE newfieldnames = [IEname, Names.UD["IELEN"]] else: newfieldnames = fieldnames super(UD, self).update(newfieldnames, varname, value)
def __init__(self): self.players = [Field((0, 0), (0, 0)), Field((0, 0), (0, 0))] self.Ready = [False, False] self.moves = [None, None] self.wins = [0, 0] self.ties = 0 self.turn = 0
def getKlassList(self, inRs): klassName = '' oldKlassEng = '' for row in inRs: try: #번호 클래스명 가시성 타입 속성명 seqNo, klassName, fieldVisibility, fieldType, fieldName = row[0:5] except (ValueError): print 'excel input file is invalid' sys.exit(2) if fieldName == '': break if oldKlassEng != klassName: aKlass = Klass() aKlass.setAttributes(klassName) #self.setMethod(aKlass) self.klassList.append(aKlass) oldKlassEng = klassName if len(fieldName) > 0: aField = Field(self.CONS) aField.setAttributes(fieldVisibility, fieldType, fieldName) aKlass.addFieldList(aField) return self.klassList
def _build_form(self): """This is a private method that builds up the form array ready for processing. There are no parameters and no return values since it use just class based instance variables. - parameters :param None: There are no parameters for this method - return :return: none - return type :rtype: not applicable """ self._username = pygame_textinput.TextInput('tahoma', 30, True, self._text_color, self._text_color, 400, 35) self._password = pygame_textinput.TextInput('tahoma', 30, True, self._text_color, self._text_color, 400, 35) # now create a field object for each one and add it to the forms array self._form.append(Field("username", self._username, 444, 345)) self._form.append(Field("password", self._password, 444, 474)) # now set the index of the form that should be input first self._form_index = 0
def project_tree(): """ Relation between topic and activity """ form = SQLFORM.factory( Field('project_name', label=T('Project Name'), comment=T('Ingrese el nombre del proyecto'), requires=IS_IN_DB(db, 'projects.id', '%(name)s')), Field('process_file', 'upload', label=T('Spreadsheet File'), comment=T('Ingresar archivo pre-formateado'), uploadfolder=UPLOAD_PATH)) if form.process().accepted: projectname = form.vars.project_name filename = form.vars.process_file file_type = None if request.vars.process_file != '': file_type = request.vars.process_file.type if file_type == EXCEL_FILE or file_type == OLD_EXCEL_FILE: excel_process(filename, projectname) response.flash = 'Archivo Procesado!' else: response.flash = 'Archivo No Reconocido!' form2 = SQLFORM.grid(db.project_tree, # create=False, ) return dict(form=form, form2=form2)
def initSS(): CheckBox("General FMA", False) CheckBox("Full Map Attack", False) CheckBox("Kami Vac", False) for mob in enemyMobs: SunCat.FilterMob(mob) if Field.GetID() not in list(range(ssMapStart, ssMapEnd + 1)) + [ssMapTown, ssExitMap]: print("Rush to Arcana town") Rush(ssMapTown) elif Field.GetID() == ssMapTown: if checkSScoin(): SCLib.UpdateVar("SpiritDone" + CharName, True) return retryCount = 0 while retryCount < 3 and Field.GetID() == ssMapTown: print("Attempting to join Spirit Savior") Party.LeaveParty() Npc.ClearSelection() Npc.RegisterSelection("Attempt <Spirit Savior>") Character.TalkToNpc(3003381) time.sleep(3) retryCount += 1 if retryCount == 3: SCLib.UpdateVar("SpiritDone" + CharName, True) return
def TerminalATK(flag, quest=False): if not quest: if useSI: Terminal.SetCheckBox("Skill Injection", flag) else: Terminal.SetCheckBox("Auto Attack", flag) else: Terminal.SetCheckBox("Skill Injection", False) Terminal.SetCheckBox("General FMA", False) Terminal.SetCheckBox("Full Map Attack", False) Terminal.SetCheckBox("Melee No Delay", False) Terminal.SetCheckBox("Auto Attack", flag) if useKami: Terminal.SetCheckBox("Kami Vac", flag) elif useFallLegit: Terminal.SetCheckBox("Legit Vac", flag) Terminal.SetCheckBox("Mob Falldown", flag) if flag: _left = Field.GetRect().left _right = Field.GetRect().right _mid = (_left + _right) / 2 if not (_mid - 10 < Character.GetPos().x < _mid + 10): Character.AMoveX(int(_mid)) time.sleep(walkTime)
def ToMid(): sp = Field.FindPortal("sp").x down00 = Field.FindPortal("down00").x pos = Character.GetPos().x if not ((pos < sp + 5 and pos > sp - 5) or (pos < down00 + 5 and pos > down00 - 5)): ToPortal("down00", False)
def __init__(self, name, parent): super(UD, self).__init__(name, parent) self.myFields[Names.UD["UDL"]] = Field.Field(Names.UD["UDL"], self, self.encodeUDL) self.myFields[Names.UD["UDHL"]] = Field.Field(Names.UD["UDHL"], self, self.encodeUDHL) self.myFields[Names.UD["USRDATA"]] = Field.Field( Names.UD["USRDATA"], self, self.encodeUD)
def __create_fields(self): """ :return: """ field1 = Field.Field() field2 = Field.Field() return field1, field2
class SponsorBalanceChangeSchema: table_name = "SPONSOR_BALANCE_CHANGE" table_desc = "广告商余额变化表" schema_fields = [ Field("SBC_ID", Type.bigint, None), Field("SPONSOR_ID", Type.bigint, 0), Field("CHANGE_AMOUNT", Type.int, 0), Field("CHANGE_TYPE", Type.int, 0), ]
def copy_board(board): tmp = [] for i in board: for j in i: new_field = Field(j.number, j.from_example, j.row, j.column) new_field.domain = np.copy(j.domain) tmp.append(new_field) tmp_board = np.reshape(np.array(tmp), (9, 9)) return tmp_board
class AdClickChargeUpProgressSchema: table_name = "AD_CLICK_CHARGE_UP_PROGRESS" table_desc = "" schema_fields = [ Field("ACCUP_ID", Type.int, None), Field("FIN_SYS_ID", Type.int, 0), Field("PROGRESS_ACI_ID", Type.bigint, 0), Field("MAX_LOG_TIME", Type.bigint, 0), Field("REMARK", Type.varchar, None), ]
def InitAll(): Terminal.SetCheckBox("bot/si_no_wait", True) Terminal.SetCheckBox("Kami Vac", False) Terminal.SetCheckBox("General FMA", False) Terminal.SetCheckBox("Full Map Attack", False) Terminal.SetCheckBox("bot/kanna_kami", False) if Field.GetID() not in ([startingMap, exitMap]+hungryMutoMaps): Terminal.Rush(startingMap) if usingParty: time.sleep(5) if Field.GetID() == startingMap: print('Starting...') SunCat.HookChuChu() InitRecipes() Terminal.SetCheckBox("Auto NPC", True) changeChannel() retryCount = 0 tryAgain = True while tryAgain: if retryCount > 3: print("Failed to enter ChuChu, have you already done it 3 times? Move to next daily") SCLib.UpdateVar("ChuchuDone", True) break Npc.ClearSelection() Npc.RegisterSelection("Enter <Hungry Muto>") if isHardMode: Npc.RegisterSelection("Hard") else: Npc.RegisterSelection("Normal") Character.TalkToNpc(3003166) time.sleep(5) if Field.GetID() == startingMap: print("Creating a new party...") if not usingParty: Party.LeaveParty() Party.CreateParty() retryCount += 1 time.sleep(2) elif Field.GetID() in hungryMutoMaps: print("Starting ChuChuPQ!") tryAgain = False DoChuChu() else: tryAgain = False print("Not in ChuChuPQ!") SunCat.UnhookChuChu() else: print("Not in ChuChu Entry Map!")
def test_played(self): field = Field() field.hintRemain -= 1 # O1 => Success self.assertEqual(type(PlayResult.Success()), type(field.play(Card(cardId=0)))) # print(field.played) # O1 => Fail because the same card already played self.assertEqual(type(PlayResult.Failed()), type(field.play(Card(cardId=0)))) # print(field.played) # O3 => Fail self.assertEqual(type(PlayResult.Failed()), type(field.play(Card(cardId=5)))) # print(field.played) # O2 => Success self.assertEqual(type(PlayResult.Success()), type(field.play(Card(cardId=3)))) # print(field.played) # O3 => Success self.assertEqual(type(PlayResult.Success()), type(field.play(Card(cardId=5)))) # print(field.played) # O4 => Success self.assertEqual(type(PlayResult.Success()), type(field.play(Card(cardId=7)))) # print(field.played) # O5 => Success and recovery a hint self.assertEqual(type(PlayResult.Success()), type(field.play(Card(cardId=9)))) # print(field.played) # check if hint is recovered self.assertEqual(8, field.hintRemain)
def genFields(self): self.fields = [] lObst = self.genObst() lDirt = self.genDirts(lObst) for i in range(self.n): for j in range(self.n): if (i, j) in lObst: self.fields.append(Field((i, j), 'obstacle')) elif (i, j) in lDirt: self.fields.append(Field((i, j), 'dirt')) else: self.fields.append(Field((i, j), 'empty'))
def __init__(self, name, parent): super(SIMCmd, self).__init__(name, parent) self.myFields[Names.SIMCMD["CPL"]] = Field.Field(Names.SIMCMD["CPL"], self, self.encodeCPL) self.myFields[Names.SIMCMD["CHL"]] = Field.Field(Names.SIMCMD["CHL"], self, self.encodeCHL) self.myFields[Names.SIMCMD["SPI"]] = Field.Field(Names.SIMCMD["SPI"], self, "", self.dissectSPI) self.myFields[Names.SIMCMD["KiC"]] = Field.Field(Names.SIMCMD["KiC"], self, "", self.dissectKI) self.myFields[Names.SIMCMD["KiD"]] = Field.Field(Names.SIMCMD["KiD"], self, "", self.dissectKI) self.myFields[Names.SIMCMD["TAR"]] = Field.Field(Names.SIMCMD["TAR"], self) self.myFields[Names.SIMCMD["CNTR"]] = Field.Field(Names.SIMCMD["CNTR"], self) self.myFields[Names.SIMCMD["PCNTR"]] = Field.Field(Names.SIMCMD["PCNTR"], self) self.myFields[Names.SIMCMD["RC_CC_DS"]] = Field.Field(Names.SIMCMD["RC_CC_DS"], self) self.myFields[Names.SIMCMD["SECDATA"]] = Field.Field(Names.SIMCMD["SECDATA"], self) #, self.encodeSECDATA)
def example_protocol(): sf = StartField.StartField( 'myProtocol', 'This is an example protocol that says the second byte is the amount of wins I have if the first bit in the first byte is bigger than 8, otherwise it is the number of losses' ) sf.set_dependency_pattern('Integer') sf.set_dependency_protocol('Dependent protocol') f1 = Field.Field(1) sf.set_next_constructs([f1]) f1.set_field_info('TypeBitCheck', 'check', 'Checks first bit', 'ftypes.UINT8', 'base.HEX', '0x80', '?', 'True') ref_list = ReferenceList.ReferenceList('ref_list') ref_list.set_descriptions(['is a value']) ref_list.set_values(['13']) f1.set_ref_list(ref_list) expr1 = Expression.Expression() expr1.set_relational_operators(['>=']) expr1.set_operands(['8']) expr2 = Expression.Expression() expr2.set_relational_operators(['<']) expr2.set_operands(['8']) dc = DecisionConstruct.DecisionConstruct() dc.set_expressions([expr1, expr2]) f1.set_next_constructs([dc]) f2 = Field.Field(1) f2.set_field_info('Number of wins', 'wins', 'Is the number of wins', 'ftypes.UINT8', 'base.HEX', '0xff', '?', 'True') f3 = Field.Field(1) f3.set_field_info('Number of loses', 'loses', 'Is the number of loses', 'ftypes.UINT8', 'base.HEX', '0xff', '?', 'True') dc.set_next_constructs([f2, f3]) end_field = EndField.EndField() f2.set_next_constructs([end_field]) f3.set_next_constructs([end_field]) protocol = Protocol.Protocol() protocol_structure = protocol.get_protocol_structure(sf) return protocol_structure
def EnterPortal(pos, enter=True): _map = Field.GetID() _portal = Field.FindPortal(pos) _char = Character.GetPos() if not (_portal.x - 10 < _char.x < _portal.x + 10) or not (_portal.y - 5 < _char.y < _portal.y + 5): Character.Teleport(_portal.x, _portal.y) time.sleep(teleportTime) if enter: Character.EnterPortal() time.sleep(teleportTime)
def to_portal(pname, enter=True): map = Field.GetID() portal = Field.FindPortal(pname) if portal.valid: if not ((portal.x-10 < Character.GetPos().x < portal.x+10)\ and (portal.y-10 < Character.GetPos().y < portal.y+15)): Character.Teleport(portal.x, portal.y-20) time.sleep(1) attempt = 0 while enter and Field.GetID() == map and attempt < 3: attempt += 1 Character.EnterPortal() time.sleep(1)
def __init__(self): self.started = 0 self.qposes = [] self.curquests = [] self.state='move' self.curf=Field(10,10,1,1) self.world={(0,0):self.curf} self.curfpos=(0,0) self.Drawing = Drawing(self.curf) self.bind_moves() self.player = Player(self.Drawing.mainwindow) self.Drawing.draw_gui(self.player,self.curfpos,self.world,self.qposes) self.Drawing.draw_npcs(self.curf.npcs) self.Drawing.mainwindow.mainloop()
def GotoHorntail(): ToggleKami(False) ToggleHyperTeleportRock(True) print("Going to Horntail") if Field.GetID() != CaveOfLifeEntrance: if Field.GetID() != PeakOfTheBigNest: Terminal.Rush(PeakOfTheBigNest) else: ToggleHyperTeleportRock(False) time.sleep(0.5) Terminal.Rush(CaveOfLifeEntrance) else: Party.CreateParty() Npc.ClearSelection() Character.TalkToNpc(2083000)
def RushCheck(ID): if (ID == 450007210 or ID == 450007230) and Field.GetID() < 450007200: Terminal.Rush(450007030) while Terminal.IsRushing(): time.sleep(1) Terminal.Rush(450007040) while Terminal.IsRushing(): time.sleep(1) while Field.GetID() != 450007200: Character.TalkToNpc(3003533) time.sleep(3) if Field.GetID() != ID: Terminal.Rush(ID) while Terminal.IsRushing(): time.sleep(1)
def WaitForFollow(user, startTime): timer = 0 time.sleep(3) while (Field.GetID() != user.mapid or GameState.GetChannel() != user.channel) \ and time.time() - startTime < timeout: time.sleep(1) timer += 1 if Terminal.IsRushing(): #print(Field.GetID(), user.mapid, GameState.GetChannel(), user.channel) if Field.GetID() != user.mapid or GameState.GetChannel( ) != user.channel: print("Failed in chasing {0} at {1} Ch{2}".format( user.charname, user.mapid, user.channel), flush=True) Terminal.StopRush()
def from_node(self, node): uniq=0 for field in node.xpathEval('fields/field'): name = field.prop('name') assert name self.fields[name] = Field.new(self, name, field) for constraint in node.xpathEval('constraints/constraint'): raise NotImplementedError('you used a constraint! please implement them...') for index in node.xpathEval('indexes/index'): name = index.prop('name') if not name: uniq += 1 name = 'index_%04x' % uniq self.indexes[name] = Index.new(self, name, index) # the default for these are handled by Modeling itself self.className= node.prop ('class_name') self.moduleName= node.prop ('module_name') self.externalName= node.prop ('external_name') # of no use (yet) isAbstract= node.prop ('is_abstract') self.isAbstract= isAbstract and isAbstract.lower()=='true' ro= node.prop ('is_read_only') self.isReadOnly= ro and ro.lower()=='true'
def readExcelInfo(self, inFile): xl = ReadExcel(inFile) sheetnames = xl.worksheets() # print sheetnames for sheet in sheetnames: #------------------------------------------------------------------- if sheet == 'TABLE_Source': entityName = '' oldentityName = '' for row in xl.getIter(sheet, True): #ClassName 속성 가시성 타입 기본값 속성 try: tableViewName, columnName, columnDatatype, columnNullOption, \ columnIsPK, columnIsFK, attributeName, entityName = row[0:8] except (ValueError): print '엑셀 파일에 문제가 있습니다. 열의 개수가 너무 많습니다.' sys.exit(2) if entityName == 'EntityName': continue if attributeName == '': break if oldentityName != entityName: aKlass = Klass() aKlass.setAttributes(entityName,tableViewName) self.klassListFromExcel.append(aKlass) self.setKlassDictByName(entityName,aKlass) oldentityName = entityName if len(attributeName) > 0: aField = Field(self.typeMapper) #ClassName 가시성 타입 속성명 aField.setAttributes(columnName, columnDatatype, columnNullOption, \ columnIsPK, columnIsFK, attributeName) aKlass.addFieldList(aField) #------------------------------------------------------------------- return self.klassListFromExcel
def traceWalk(drunkKinds, numSteps): styleChoice = styleIterator(('b+', 'r^', 'mo')) f = Field() for dClass in drunkKinds: d = dClass() f.addDrunk(d, Location(0, 0)) locs = [] for s in range(numSteps): f.moveDrunk(d) locs.append(f.getLoc(d)) xVals = [] yVals = [] for I in locs: xVals.append(I.getX()) yVals.append(I.getY()) curStyle = styleChoice.nextStyle() pylab.plot(xVals, yVals, curStyle, label = dClass.__name__) pylab.title('Spots Visited on Walk (' + str(numSteps) + ' steps)') pylab.xlabel('Steps East/West of Origin') pylab.ylabel('Steps North/South of Origin') pylab.legend(loc = 'best')
global unit unit.set_target((0,0)) places = load_data('tile1.txt', 'data') static_obj_lst = load_data('static_obj.txt', 'data') container = Container() pygame.init() screen = pygame.display.set_mode((RES_X,RES_Y)) # pygame.mouse.set_visible(0) clock = pygame.time.Clock() done = False field = Field(0, 0, places, static_obj_lst) unit = Unit(3, 2, field) field.add_unit(unit) button = Button(500,10,('button_click.png','button_hover.png','button_off.png'), function=go_to,text='Go to') container.adds(field, unit, button) while not done: screen.fill((0, 0, 0)) for e in pygame.event.get(): if e.type == pygame.QUIT: done = True container.event(e)
#!/usr/python #-*- coding: utf-8 -*- from Field import * from Sensor import * from Target import * from Program import * print "PROJET DE TECHNIQUE D'OPTIMISATION" print "\tAntoine De Gieter" print "\tAlexis Beaujon" field = Field() choice = 0 while choice != 1 and choice != 2: choice = input("1] Configuration aléatoire\n2] Configuration manuelle\n") if choice == 1: field.initRandom() Program.generateLP(field, "problem.lp") Program.solve("problem.lp", "solution.sol") print "\n" Program.interpretation("solution.sol") elif choice == 2: targets_nb = input("Number of targets:") print "---" sensors_nb = input("Number of sensors:") print "---" field.init(targets_nb, sensors_nb) Program.generateLP(field, "problem.lp")
#!/usr/python #-*- coding: utf-8 -*- from Field import * from Sensor import * from Target import * import os field = Field() field.initRandom() # # Generate first line # output = "Maximize " n = 0 for s in field._get_sensors(): n += 1 if n > 1: output += " + " output += "x" + str(n) output += "\n\nSubject To\n\n" # # Generate sensor equations # for s in field._get_sensors(): n = 0 first = True