def main(): # 設定書くと見づらいからプリセットを使う preset = Preset() # このコメント書いてる時は1~9のプリセット optimizer_list, graph = preset.preset_5() # 描画のためのセットアップ drawer = Drawer(optimizer_list, graph) # アニメーション作成 drawer.animation() # 保存 #drawer.save_animation("optimization.gif", "./") # 表示 drawer.show()
def add_preset(self, name): preset = Preset(name, self.speed.get(), self.accel_time.get(), self.deccel_time.get()) if self.mode == 'auto': preset.work_time = self.work_time.get() if self.auto_groups_id == -1: self.auto_presets.append(preset) else: self.auto_groups[self.auto_groups_id].presets.append(preset) self.group_selected(None, len(self.get_cur_group().presets) - 1) self.save_presets() return else: self.manual_presets.append(preset) self.save_presets() self.update_presets_combobox() index = len(self.combobox_presets['values']) - 1 self.combobox_presets.current(index)
def test_is_suitable_rune_2(self): preset = Preset(monster=Monster('any', stats={})) preset.include(violent, will) self.assertTrue( preset.is_suitable_rune(make_rune(slot=1, set='Violent'))) self.assertTrue(preset.is_suitable_rune(make_rune(slot=2, set='Will')))
def setUp(self): self._preset = preset = Preset(monster=Monster(name='Searra', stats={ 'hp': 10875, 'atk': 801, 'def': 615, 'spd': 100, 'acc': 25 })) preset.include(violent, will) preset.expect( Stat('spd', Between(min=205, max=220)), # 105 Stat('atk', Around(2000)), # 150% Stat('hp', Around(20000)), # 97% Stat('acc', Between(min=60, max=85)), # 50% )
from preset import Preset, Stat, Min, Around, Between from rune import RuneSets copper = Preset('Copper') copper.include(RuneSets.Guard, RuneSets.Blade) copper.exclude(RuneSets.Violent) copper.expect( Stat('cr', Between(70, 80)), Stat('cd', Around(250)), Stat('def', Min(2000)), Stat('atk', Around(800)), )
def test_is_suitable_rune_3(self): preset = Preset(monster=Monster('any', stats={})) preset.include(violent, will) self.assertFalse( preset.is_suitable_rune(make_rune(slot=1, set='Guard')))
def test_is_suitable_rune_1(self): preset = Preset(monster=Monster('any', stats={})) preset.exclude(violent) self.assertTrue(preset.is_suitable_rune(make_rune(slot=1, set='Guard')))
BRIGHTNESS = 0.3 if PROD_MODE else 0.1 strip = neopixel.NeoPixel( NEOPIXEL_PIN, PIXELS_PER_STRIP * STRIP_COUNT, brightness=BRIGHTNESS, auto_write=False) btle = busio.UART(board.TX, board.RX, baudrate=9600, timeout=3) strip.fill((0, 0, 0)) strip.show() statusInIo = digitalio.DigitalInOut(board.D7) statusInIo.direction = digitalio.Direction.INPUT statusInIo.pull = digitalio.Pull.DOWN PRESETS = [ Preset(0), Preset(1), Preset(2), ] star_mode = None star_step = 0 def bufToString(data): if data is None: return '' else: return ''.join([chr(b) for b in data]) def sendAtCommand(cmd = False):
if not os.path.isfile('/tmp/tx.txt'): print "File tx non trovato..." AtomicWrite.writeFile('/tmp/tx.txt', "") relay = Relay() #front = Front() #icomin = IcomIn("P9_33") #band = Band(icomin) settings = Settings() #radioa = Radio("P9_15", "P9_29", "P8_19", "P8_7", "P8_9", "P8_11") #radiob = Radio("P9_17", "P9_31", "P8_26", "P8_13", "P8_15", "P8_17") preset = Preset() #txing = "" clear = True lastband = "-1" presetchanged = False oldpresetA = "" oldpresetB = "" #def tx(R,S): # AtomicWrite.writeFile("/tmp/tx"+R+".txt",str(S)) def getFileContent(filename): txt = open(filename) return txt.read() while True:
def test_manager_preserves_order(self): runes = ( make_rune( slot=1, set='Violent', grade=6, lvl=12, primary=('atk', 118), sub_stats=( ('cr', 15), ('cd', 18), ('atk%', 10), ('hp%', 8), ) ), make_rune( slot=1, set='Blade', grade=6, lvl=12, primary=('atk', 118), sub_stats=( ('cr', 15), ('cd', 18), ('atk%', 10), ('hp%', 8), ) ), make_rune( slot=2, set='Guard', grade=6, lvl=12, primary=('def%', 63), sub_stats=( ('cr', 8), ('cd', 24), ('atk%', 10), ('res', 8), ) ), make_rune( slot=3, set='Guard', grade=6, lvl=12, primary=('def', 118), sub_stats=( ('cr', 8), ('cd', 16), ('hp%', 10), ('def%', 16), ) ), make_rune( slot=4, set='Blade', grade=6, lvl=12, primary=('cd', 80), sub_stats=( ('cr', 8), ('res', 8), ('hp%', 10), ('def%', 24), ) ), make_rune( slot=5, set='Guard', grade=6, lvl=12, primary=('hp', 2040), sub_stats=( ('cr', 8), ('cd', 24), ('hp%', 10), ('res', 8), ) ), make_rune( slot=6, set='Guard', grade=6, lvl=12, primary=('def%', 63), sub_stats=( ('cr', 8), ('cd', 18), ('hp%', 16), ('res', 8), ) ), ) manager = RuneManager(runes) preset = Preset(monster=Monster(name='copper', stats={ 'hp': 9555, 'atk': 483, 'def': 692, 'spd': 98, 'res': 40 })) preset.include(blade, guard) preset.exclude(violent) preset.expect( Stat(name='cr', condition=Min(70)), Stat(name='def', condition=Around(2000)) ) manager.add_monster(preset) builds = list(manager.optimize()) self.assertEqual(1, len(list(builds))) build = builds[0] print(build) self.assertEqual(1, build.sets.count('Blade')) self.assertEqual(2, build.sets.count('Guard')) self.assertEqual(build.attack, 697.6) self.assertEqual(build.defense, 1958.72) self.assertEqual(build.crit_rate, 70) self.assertEqual(build.crit_dmg, 230) self.assertEqual(build.hit_points, 16754.7) self.assertEqual(build.speed, 98) self.assertEqual(build.resistance, 40) self.assertEqual(build.accuracy, 0)
from preset import Preset, Stat, Around, Between from rune import RuneSets print(RuneSets.Violent) searra = Preset('Seara') searra.include(RuneSets.Violent, RuneSets.Will) searra.expect( Stat('spd', Between(min=208, max=220)), Stat('acc', Between(min=65, max=85)), Stat('hp', Around(25000)), Stat('atk', Around(2500)), ) # find all builds where first stat is satissfied # then of just found find where stat 2 is collected
from preset import Preset, Stat, Around, Between from rune import RuneSets theomars = Preset('Theomars') theomars.include(RuneSets.Violent, RuneSets.Will) theomars.expect( Stat('spd', Between(min=190, max=210)), Stat('cr', Between(min=60, max=70)), Stat('cd', Around(150)), Stat('atk', Around(2000)), Stat('hp', Around(20000)), )