def menu(): keep_going = 'y' while (keep_going == 'y'): print("Menu") print("1. Calculator") print("2. Number Guesser") print("3. Pop Quiz") print("4. Read File") print("5. Exit") choice = int(input('Please enter your choice: ')) if choice == 1: calc.ACmenu() elif choice == 2: numGuess.game() elif choice == 3: memory.memBank() elif choice == 4: readFile.read() elif choice == 5: print("Exiting") keep_going = 'n' else: print( '\nChoice was not valid. Please choose a valid option between 1 - 3.' )
def import_beams(): global beam_g1 beam_g1 = read('FF_11.ffe') beam_g2 = read('FF_inf_dense.ffe') py.plot(10**(beam_g1 / 10) / (max(10**(beam_g1 / 10)))) py.plot(10**(beam_g2 / 10) / (max(10**(beam_g2 / 10))))
def newPop(): #формирование новой популяции global oldpop spop = sorted(oldpop + newpop, key=lambda x: x[1]) spop = spop[::-1] oldpop = spop[0:200] def start(x): #объединяем функции global oldpop oldpop = [] global newpop newpop = [] global things things = [] startPop() fitness() for k in range(0, x): selection() newPop() return oldpop[0] oldpop = [] newpop = [] pcount = 200 things = [] readFile.read() res = start(100) print(res[1], res[0])
#!/home/md98/bamboo_env/bin python # -*- coding: UTF-8 -*- import readFile import scaling if __name__ == '__main__': text_file_directory = '../data/' for text_file_number in range(40491, 37840, -1): text_file_name = str(text_file_number) + '.txt' text_file = text_file_directory + text_file_name print(text_file) readFile.read(text_file) output = open('nouns/' + str(text_file_number) + str('.txt'), "a") for noun in scaling.getFilteredData(readFile.data, scaling.filter_pronouns): output.write(noun + " ") output.close()
from readFile import read import os # Get paths dir_name = os.path.dirname(__file__) folder = os.path.join(dir_name, 'data/') files = os.listdir(folder) files = [file for file in files if file[-4:] == '.bn4'] # Declare parameters binSize = 400 channels = 8 maxLength = 720000 # in 100ns unith # Iterate through data for file in files: path = folder + file read(path, binSize, channels, maxLength)
from readFile import read from initialize import initialize_q_table import random import numpy labirint = read() MATRIX_SIZE = len(labirint[0]) SUCCESS_EXIT = (0,0) BUST_EXIT = (1,0) START_POS = (3,3) LEARNING_RATE = 0.7 PENALTY = 0.05 a = ['up','down','right','left'] DIRECTIONS = {'up':(1,0),'down':(-1,0),'right':(0,1),'left':(0,-1)} NR_STEPS = 500 NR_EPISODES = 30 epsilon = 1 (q,na) = initialize_q_table(MATRIX_SIZE) def qLearning(qStart,dim): action = '' episodes = NR_EPISODES eps = epsilon while episodes != 0: