def make_multiplayer_move(self, first_player): """ Method for making multiplayer move :param first_player: bool """ if first_player: while not self.client.received: pass self.field, self.player = saver.load(self.client.recv_str) else: data = saver.save(self.field, self.player) self.client.send(data) while not self.client.received: pass self.field, self.player = saver.load(self.client.recv_str) self.previous_player = not self.player self.client.recv_str = '' self.client.received = False
def file_load(): """ Function for loading field from file """ file = tkinter.filedialog.askopenfile() if file: self.game.field, self.game.player = saver.load(file.read()) self.draw_pawns(self.game.field) file.close()
def load(): try: player, map = saver.load(World.SAVE_DIR) except FileNotFoundError: raise NoSavedGamesError world = World(map=map) world._player = player return world
def on_load(): global trigger_list print('on_load: loading...') file = filedialog.askopenfilename(filetypes=[('jad files', '.jad')]) trigger_data = [trigger_t(*a) for a in load(file)] trigger_list.clear() clear_list() for tr in trigger_data: trigger_list.append(tr) add_list_item(tr)
def load(): global world global world_size logger.debug('Try to load game') try: player_pos, world = saver.load(SAVE_DIR) except FileNotFoundError: raise RuntimeError('No saved games.') world_size = len(world) logger.debug('Game loaded successfully') return player_pos
replay_buffer, writer, filename, learner.actor.parameters, agent_to_learner, learner_to_agent) # Add thread and process to the list threads.append( threading.Thread(target=actor.run, args=(stop_run_flag, replay_buffer_dump_flag, starting_episode_number))) environment_processes.append( multiprocessing.Process(target=environment.run, daemon=True) ) # daemon ensures process is killed when main ends # If desired, try to load in partially-trained parameters if Settings.RESUME_TRAINING == True: if not saver.load(): # If loading was not successful -> quit program print("Could not load in parameters... quitting program") raise SystemExit else: # Don't try to load in parameters, just initialize them instead # Initialize saver saver.initialize() # Initialize Tensorflow variables sess.run(tf.global_variables_initializer()) # Starting all environments for each_process in environment_processes: each_process.start() #############################################
def test_saver(self): field, player = self.load_identity() string = saver.save(field, player) field2, player2 = saver.load(string) self.assertEqual((field, player), (field2, player2))
# -*- coding: utf-8 -*- """ Created on Tue Feb 20 17:49:53 2018 @author: cz """ from sceneplot import ScenePlot import saver sc = saver.load(4) sp = ScenePlot(sc) sp.plot(sp.TYPE_TIME_ACTIONS)
import pygame import funcs import glbl_nms import saver pygame.init() clock = pygame.time.Clock() pygame.display.set_caption("MIPT study") saver.load() # загрузка сохранения while glbl_nms.RUN: clock.tick(30) # FPS funcs.rndm_events() funcs.key_checker() funcs.stat_decrease() # decrease stats funcs.timer() # anim timer funcs.a_u_ok() # checking stats for borders funcs.draw_screen() saver.save() # Сохраняем pygame.quit()
def load(self, fn): '''Load project''' saver.load(fn)
def test_saver(self): field, player = self.load_identity() string = saver.save(field, player) field2, player2 = saver.load(string) self.assertEqual((field, player), (field2, player2))