def run(self): """Run Worker Thread.""" # This is the code executing in the new thread. e = emulator.emulator() e.setupEmulation(self.path) x = 0 while self.running: if self.step: e.runEmulation() self.step = False if not self.paused: e.runEmulation() #wx.CallAfter(self.postTime, i) #wx.CallAfter(Publisher().sendMessage, "update", "Thread finished!") print "Thread finished"
ROOT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..') ### Get the logging configuration file fileConfig(os.path.join(ROOT_DIR, 'config', 'logging.ini')) ### Instantiate the logger object logger = logging.getLogger() logger.info('Running emulator') ### Get the 'setup.ini' file handler config = configparser.ConfigParser() ### Load the file to the config handlers config.read(os.path.join(ROOT_DIR, 'config', 'setup.ini')) ### Get the 'frequency in seconds' and also the 'number of sensors' from the setup.ini file frequency_in_seconds = config["emulator"]["frequency_in_seconds"] numSensors = config["emulator"]["numSensors"] ### Define if you are publishing to the MQTT broker (local = False) or not (local = True) local = False ### Define if you are saving the MQTT messages the the influxDB store_db = True ### Instantiate the emulator emulator = e.emulator(frequency_in_seconds, numSensors, local, store_db) ### Run the emulator emulator.run()
import pyglet from emulator import emulator def start(dt): pyglet.clock.schedule_interval(emulator.main, 1/1000) #need this for pyglet def update(dt): if emulator.cpu.opcode != 0x1210: emulator.cpu.cycle() else: pyglet.clock.unschedule(update) pyglet.clock.schedule_once(start, 3) if __name__ == '__main__': template = pyglet.gl.Config(double_buffer=True) emulator = emulator(640, 320, config=template, caption="Chip-8 emulator") emulator.loadROM('IBM.ch8') pyglet.clock.schedule(update) pyglet.app.run()
def evaluate(id, results, vhm): from emulator import emulator data = emulator(vhm) results[id] = fitness(data)
from emulator import emulator from source.Entities.MainController import MainController from source.Entities.user import UsrController if __name__ == "__main__": choosing = MainController.makeChoosing(["Main", "Emulator"], "Program ui") if choosing == 0: UsrController() elif choosing == 1: emulator()