本文整理汇总了Python中Level.Level.loadFromMap方法的典型用法代码示例。如果您正苦于以下问题:Python Level.loadFromMap方法的具体用法?Python Level.loadFromMap怎么用?Python Level.loadFromMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Level.Level
的用法示例。
在下文中一共展示了Level.loadFromMap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadFromJsonFiles
# 需要导入模块: from Level import Level [as 别名]
# 或者: from Level.Level import loadFromMap [as 别名]
def loadFromJsonFiles():
CharIndexMap.rangeTypeisCharacterBased=False
seed=None
baseMcCfg=Util.readJsonFileIntoObject("./state/baseMcCfg.json")
baseMachine=EnigmaDynamicFactory().createEnigmaMachineFromConfig(baseMcCfg)
baseMcStg=MachineSettingsMemento.loadFromMap(Util.readJsonFileIntoObject("./state/baseMcStg.json"))
baseMachine.adjustMachineSettings(baseMcStg)
levelMcCfg=Util.readJsonFileIntoObject("./state/levelMcCfg.json")
levelMachine=EnigmaDynamicFactory().createEnigmaMachineFromConfig(levelMcCfg)
levelMcStg=MachineSettingsMemento.loadFromMap(Util.readJsonFileIntoObject("./state/levelMcStg.json"))
levelMachine.adjustMachineSettings(levelMcStg)
level=Level.loadFromMap(Util.readJsonFileIntoObject("./state/level.json"))
msg="Hello Enigma !"
msgSeq=Util.encodeStringIntoByteList(msg)
level.inputMsg=msgSeq
levelEncryptor=LevelEncryptor(baseMachine,levelMachine,level,seed)
encLevel=levelEncryptor.encryptLevel()
print("ENC:")
print(Util.convertByteListIntoHexString(encLevel.outputMsg))
encLevel.inputMsg=""
levelDecryptor=LevelDecryptor(baseMachine,levelMachine,level)
levelDecryptor.level=encLevel
resultLevel=levelDecryptor.decryptLevel()
print("DEC:")
print(resultLevel.inputMsg)
print(Util.decodeByteListIntoString(resultLevel.inputMsg))
print("DONE !!")
return resultLevel.inputMsg
pass