Пример #1
0
 def load_game(self):
     path = QFileDialog.getOpenFileName(self, 'Open save file',
                                        QDir.currentPath() + '/sav')[0]
     if path != '':
         game, msg, count = load(path)
         self.play_widget.resume_from_save(game, msg, count)
         self.widgets.setCurrentWidget(self.play_widget)
         self.statusbar.showMessage('Loaded save file', 5000)
 def file_open(self):
     filename = QtWidgets.QFileDialog.getOpenFileName(self, 'Open File', os.getcwd())
     fileopen=QtCore.QFile(filename[0])
     if fileopen.open(QtCore.QFile.ReadOnly | QtCore.QFile.Text)==None :
         print("fileopen.open(QtCore.QIODevice.WriteOnly)==None")
         return -1
     else :
         receivedData=load(str(filename[0]))
         self.scene.clear()
         self.scene.loadFile(receivedData)
         self.statusbar.showMessage('File Opened')
Пример #3
0
            fns = glob.glob('learned_result_*.pickle.zip')
            if len(fns)==0:
                #fns = glob.glob('learned_result_*.py')
                fns = glob.glob('learned_result_*.*')
        fn = sorted(fns,key=lambda x: int(x.split('_')[-1].split('.')[0]))[-1]
        print('loading',fn)
        if fn.endswith('.npy'):
            data = np.load(fn).item()
        elif fn.endswith('.pickle.zip'):
            import zipfile, cPickle
            with zipfile.ZipFile(fn,'r') as f:
                data = cPickle.loads(f.read('data.pickle'))
        else:
            import save_load
            reload(save_load)
            data=save_load.load(fn)['data']

        if 'type' not in data: data['type'] = 3

        if data['type']==1:
            Q=data['Q']
        elif data['type']==2:
            Q=data['Q']
            Q.shape=data['Q.shape']
        elif data['type']==3:
            if isinstance(data['Q'], dict):
                # q_learner.Q is a DefaultZeroArray --> just push data without overwriting the instance type
                Q = q_learner_system.DefaultZeroArray(data['Q.shape'])
                Q.update( data['Q'] )
            else:
                Q=data['Q']
Пример #4
0
from preprocess import get_test_train_data
from save_load import get_last_file_number
from save_load import load
from model import accuracy, loss
from keras import backend
import sys, os
import tensorflow as tf
from utils import visualize_layers 

if __name__ == '__main__':
    
    file = "F:\Projects\python\self_driving_game\data\dataset_mini.pz"
    if len(sys.argv)<=1: count = None
    else: count = int(sys.argv[1]);
    
    # Load model
    exp_folder = 'exp_' + '{0:03d}'.format(get_last_file_number(prefix='exp_', suffix=''))
    model = load(count, path=exp_folder)

    # Visualize model
    x_train, x_test, y_train, y_test = get_test_train_data(file, 10, tanh=True)
    visualization_folder = exp_folder + '/visualization'
    if not os.path.exists(visualization_folder): os.makedirs(visualization_folder)

    visualize_layers(model, x_test, path=visualization_folder)
    print('Visualization done...!')
Пример #5
0
"""
import player, sys, random
from enemies import *
from world import *
from items import *
from interactives import *
import save_load as sl
######################################################
#when more levels are added, edit lines 292, 314, 319# search #add more for more levels
######################################################
print("Copyright © 2016 Starfleet Software")
me=player.Player(0,0)
try:
	i = input('Load game? (Y/n) ')
	if i == 'y' or i == 'Y':
		me.weapon,me.name,me.wallet,me.skill, me.invent = sl.load('saves/save1.txt','saves/save1inv.txt',me,village)
except:
	print("Load/Save not available")
helplist="""

Keylist:

	Type `h:` followed by a specific keystroke for help on a certain function

	w = forward
	a = left
	d = right
	s = backward
	q = attack
	i = inventory
	h = help
Пример #6
0
    channel = await member.create_dm()
    await channel.send(content)


async def send_dm_embed(member, content):
    channel = await member.create_dm()
    await channel.send(embed=content)


TOKEN = os.getenv("token")
client = discord.Client()

global accounts
accounts = {}

accounts = save_load.load()

for item in accounts:
    item = accounts[item]
    for b in item.bonds:
        b = item.bonds[b]
        total_bond_worth_issued += b.base
        if not b.bond_class == "":
            bond_types[b.bond_class].issued += 1


@client.event
async def on_ready():
    server = client.get_guild(int(os.getenv("discord_server_id")))
    global logging_channel
    logging_channel = client.get_channel(int(os.getenv("logging_channel_id")))