def run(self): self.gpsPath = FileReader.parseGpsLog(self.gpsLog) if(self.gpsPath == -1): return print self.gpsPath if self.coreLog == None: self.coreLog = self.runCamSim() self.pathList = FileReader.parseCoreLogs(self.coreLog, self.gpsPath[0].longitude, self.gpsPath[0].latitude) if(self.pathList == -1): return optimalPath = self.getOptimalPath(self.gpsPath, self.pathList) distances = self.calculateDistances(optimalPath) self.calculateMetrics(optimalPath, distances) FileWriter.createDataSheet(self, self.totalResult, self.twentyMinuteResults) FileWriter.export(self, self.gpsPath, [optimalPath]) print "Minimum Distance" print min(distances) print "Maximum Distance" print max(distances) print 'id: ', self.scenarioID print 'core log file: ', self.coreLog print 'gps log file: ', self.gpsLog print 'time offset: ', self.timeOffset print 'maximum radius: ', self.maxRadius print 'number of paths: ', len(self.pathList)
def fetch_data(self): array1 = {} for i in range(0,len(self.tblname)): if not(self.tblname[i] in self.database.keys()): filer=FileReader(self.tblname[i]) filer.fileRead() array1=filer.hashData() self.database[self.tblname[i]]=array1
def test_get_filenames(self): # verify that a list is returned self.assertTrue(isinstance(FileReader.getFileNames('*'),list)) # verify that the list is long enough filenames = FileReader.getFileNames('*') self.assertTrue(len(filenames) > 0) # verify that the list don't contain directorys for filename in filenames: self.assertFalse(os.path.isdir(filename))
def main(): """ Main fucntion for style checking """ try: userParams, repoParams = splitArgv(sys.argv) parser = ArgumentParser(description = "StyleCop parameters") parser.add_argument("--repo", dest="repo", action="store", help="Repository that use this script in hook") parser.add_argument("--stage", dest="stage", action="store", help="Stage of work with VCS") parser.add_argument("--config", dest="config", action="store", help="StyleCop config file") args = parser.parse_args(userParams) configParser = ConfigParser() configString = FileReader.readFile(args.config) config = configParser.parse(configString) factory = repos.ReposFactory() repository = factory.getRepository(args.repo, args.stage) changedFiles = repository.getChangedFiles(repoParams) extensionsDict = config.getDictionary("extensions") checkersFactory = CheckersFactory(extensionsDict) # List of strings of style violations errors = [] for file in changedFiles: ext = getFileExtension(file) checker = checkersFactory.getChecker(ext) sourceString = FileReader.readFile(file) errors += checker.check(sourceString) except ValueError as er: pass except Exception as ex: pass if len(errors) > 0: repository.sendError("Total number of style errors: " + errors) repository.sendError("Update failed") # If there were no errors we permit this update return len(errors)
def __init__(self, trainfile, testfile, bvecfile, train_outputs): kernel = LinearKernel.Kernel() kernel.setVerbose(True) f = open(trainfile) print "Reading in training examples" kernel.readTrainingInstances(f) bvectors = FileReader.readBvectors(bvecfile) print "Building kernel matrix" kernel.buildSparseTrainingKernelMatrix(bvectors, "foo") f.close() f = open(testfile) print "Building test kernel matrix" kernel.readTestInstances(f) kernel.buildSparseTestKernelMatrix(bvectors, "foo") f.close() K_r = kernel.getSparseTrainingKernelMatrix() K_test = kernel.getSparseTestKernelMatrix() print "Decomposing kernel matrix" svals, evecs, U, Z = SparseModule.decomposeSubsetKM(K_r, bvectors) print "Solving kernel dependency estimation" KD = KernelDependency.KernelDependency(svals, evecs, U) self.KD = KD self.H = Z.T*K_test self.train_outputs = train_outputs
def PrintOutFiles(speakers,outputdir): # Now we will create the times for each speech segment for i, segment in enumerate(speakers): outputfile = '%d_speakers.txt' % (i) file = os.path.join(outputdir,outputfile) with open(file,'w') as f: for times in segment: ostring = '%d,%d\n' % (times[0],times[1]) f.write(ostring) if __name__ == "__main__": # Read in the command line prompts ThreeCharFile = sys.argv[1] DoubleCharFile = sys.argv[2] outputdir = sys.argv[3] # Create the output directory if it does not exist if not os.path.exists(outputdir): os.makedirs(outputdir) # Read in the segment times ThreeCharTimes = FileReader.read_char_times(ThreeCharFile) DoubleCharTimes = FileReader.read_char_times(DoubleCharFile) SpeakerTimes = GetTalkingTimes(ThreeCharTimes,DoubleCharTimes) # Output the files PrintOutFiles(SpeakerTimes,outputdir)
import math # arguments: parser = argparse.ArgumentParser(description='myBot', conflict_handler='resolve') parser.add_argument("-p", "--player", action="store", type=str, required=True, help="Character on the map") parser.add_argument("-b", "--boardFile", action="store", type=str, required=True, help="BoardFile.") parser.add_argument("-h", "--historyFile", action="store", type=str, required=True, help="HistoryFile.") args = parser.parse_args() #moves = ["N", "S", "W", "E"] #print random.choice(moves) Name = args.player BoardFile = args.boardFile HistoryFile = args.historyFile board = FileReader.readBoard(BoardFile) matrix = board.Map Coin = '$' def canMovePlayer(position): x,y = tuple(position) if(x < len(matrix) and y < len(matrix[0])): fieldType = matrix[x][y] if(fieldType == ' ' or fieldType == Coin): return True else: return False return False #search player and coins
def welcome(self): return fr.readFile(sp.getWelcome()) os.system('cls')
def array(self): return fr.readFile(sp.getArray()) os.system('cls')
def queue(self): return fr.readFile(sp.getQueue()) os.system('cls')
def postfix(self): return fr.readFile(sp.getPostfix()) os.syste, ('cls')
def lists(self): return fr.readFile(sp.getLists()) os.system('cls')
def factor(self): return fr.readFile(sp.getFactor()) os.system('cls')
def main_menu(self): return fr.readFile(sp.getMainMenu()) os.system('cls')
def init(self, pathToBoardFile, configs, pathToPlayerFile = None): """ This function is called to initialize the Board from a board-file or a status-file. If the pathToPlayerFile parameter is given, the first parameter is interpreted as the path to the board-file If the pathToPlayerFile parameter is omitted, the first parameter is interpreted as the path to the status-file :param pathToBoardFile: Path to board-file/status-file :param pathToPlayerFile: Path to the file of players :return: """ if pathToPlayerFile is None: # can be called by player programs, is able to extract the information in the boardCurrent file # now this functions create only the matrix, but player infos and config infos could also be stored, but where( should player objects be created??) d={} key="" with open(os.path.join(pathToOutputDirectory,"boardCurrent.txt")) as f: for line in iter(f): logging.debug( "reading line ",line) if line.startswith("board:"): emptyList = [] key="board" d.update({key:emptyList}) continue if line.startswith("configs:"): emptyList = [] key="configs" d.update({key:emptyList}) continue if line.startswith("board data:"): emptyList = [] key ="board data" d.update({key:emptyList}) continue if line.startswith("player coins:"): emptyList = [] key ="player coins" d.update({key:emptyList}) continue if(key): # key is not empty d[key].append(line) f.close() for line in d["board"]: self.matrix.append(line) else: #config self.configs = configs self.coins = int(configs.numberOfCoins) self.updateTime = float(configs.waitingTime) #store board from Board File to matrix, this file will be read only once self.matrix = FileReader.readMap(pathToBoardFile) #store players from File in list players: list of tuples(character, path to shell script) with open(pathToPlayerFile) as playerFile: for row in playerFile: rowSplits = row.split('\t') self.players.append((rowSplits[0], rowSplits[1].rstrip('\n'))) playerFile.close() #create player info list for i in range(len(self.players)): charPlayer, filePlayer = self.players[i] self.playerInfo[charPlayer] = Player(charPlayer,filePlayer) #add players from Player File at random positions size = len(self.matrix) size2 = len(self.matrix[0]) for p in self.players: index1 = randint(0,size-1) index2 = randint(0,size2-1) while(self.matrix[index1][index2] != ' '): index1 = randint(0,size-1) index2 = randint(0,size2-1) if self.matrix[index1][index2] == ' ': self.matrix[index1][index2] = p[0] self.playerInfo[p[0]].Position = (index1,index2)
import sys import math import copy import ItemSetGenerator as isg import RuleMiner as rm import FileReader as fr sparseMatrix = {} supportThres = float(sys.argv[2]) columns = ['age', 'wife education','husband education','Number of children', 'wife religion', 'wife working', 'husband occupation', 'Standard-of-living', 'Media exposure', 'Contraceptive method'] sparseMatrix = fr.readFile(sys.argv[1], columns) # fr.printSomeData(sparseMatrix, 20) k_ItemSets = isg.generateCandidatesFk_1xk_1(sparseMatrix, supportThres) rules = rm.startRuleBuilding(sparseMatrix[0], k_ItemSets) # k_ItemSets = isg.generateCandidatesFk_1x1(sparseMatrix, supportThres) # rules = rm.startRuleBuilding(sparseMatrix[0], k_ItemSets)
def timer(self): return fr.readFile(sp.getTimer()) os.system('cls')
import os.path, sys sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)) from Coordinate import Coordinate from Scenario import Scenario import FileReader import FileWriter import time gps_entries = FileReader.parseGpsLog('kmlPrintTestGpsFile.log') core_entries = FileReader.parseCoreLog('kmlPrintTestCoreFile.log') print 'Test1: valid input' scenario = Scenario(1, 5.0, '', sys.path[0], '') FileWriter.export(scenario, gps_entries, core_entries) print 'kml file printed successfully\n' print 'Test2: no core data' scenario = Scenario(1, 5.0, '', sys.path[0], '') FileWriter.export(scenario, gps_entries, list()) print 'kml file printed successfully\n' print 'Test3: no GPS data' scenario = Scenario(1, 5.0, '', sys.path[0], '') FileWriter.export(scenario, list(), core_entries) print 'kml file printed successfully\n' print 'Test4: no core or GPS data' scenario = Scenario(1, 5.0, '', sys.path[0], '') FileWriter.export(scenario, list(), list()) print 'kml file printed successfully\n'
import os.path, sys sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)) import FileReader goodFileCoordinates = FileReader.parseGpsLog('gpsFileErrorTestGoodFile.log') print 'Test 1:', '\n', 'gps file successfully parsed. number of entries: ', len(goodFileCoordinates), '\n' print 'Test 2:' FileReader.parseGpsLog('gpsFileErrorTestBadFile.log') print '\nTest 3:' FileReader.parseGpsLog('this_is_not_a_file.log') print '\nTest 4:' try: FileReader.parseGpsLog(None) except (TypeError), e: print 'None value error handled successfully' try: FileReader.parseGpsLog(3) except (TypeError), e: print 'int value error handled successfully'
def run(argv): # Now let's parse the arguements try: opts, args = getopt.getopt(argv,'hi:o:w:') except getopt.GetoptError: print "You did something wrong" sys.exit(0) video_file = None output_folder = None wavfile_dir = None for opt, arg in opts: if opt in ('-h'): print "HELP!" sys.exit(0) elif opt in ('-i'): video_file = arg elif opt in ('-o'): output_folder = arg elif opt in ('-w'): wavfile_dir = arg if not (video_file and output_folder and wavfile_dir): print "You need more arguments to run this code" sys.exit(0) ### THIS SECTION OF CODE USES THE SHoUT Toolbox ######## # Now do the diarization to start us out file_id_with_ext = reader.GetFileOnly(video_file) file_id = reader.ReplaceExt(file_id_with_ext,"") raw_file = file_id + ".raw" raw_file = os.path.join(wavfile_dir,raw_file) # Perform turning the video into ."raw" audiofile return_code = shout_vid2wav(video_file,raw_file) if return_code: print "We had an issue in: VIDEO TRANSCODING" sys.exit(0) # Perform segmentation seg_file = os.path.join(output_folder,file_id + ".seg") return_code = shout_segment(raw_file,seg_file) if return_code: print "We had an issue in: SEGMENTATION" sys.exit(0) # Perform Diarization dia_file = reader.ReplaceExt(seg_file,".dia") return_code = shout_cluster(raw_file,seg_file,dia_file) if return_code: print "We had an issue in: CLUSTERING" sys.exit(0) ################################################### # Now let's parse through the clustering file, and find the speaker times for each video person_segs = reader.read_diafile(dia_file) # Now we need to combine the sections of speech that are concurrent between people segments = reader.ConnectSpkrSegs(person_segs) # This cuts up the video and outputs it to the desired directory # Create a directory to hold all of the videos for this particular youtube program output_vid_segs_dir = os.path.join(output_folder,file_id) if not os.path.exists(output_vid_segs_dir): os.makedirs(output_vid_segs_dir) ####### Video Cutting ######## # This is for if we just want to use the smaller non-connected speech segments #cut_video(person_segs,video_file,output_vid_segs_dir,file_id) # This is for if we want to use the diarization results cut_video(segments,video_file,output_vid_segs_dir,file_id) # Now we need to output a file that has the time segments available output_seg_time_file = os.path.join(output_vid_segs_dir,file_id + ".times") with open(output_seg_time_file, "w") as f: for i,segment in enumerate(segments): output = "%03d,%.2f,%.2f\n" % (i,segment[0],segment[0]+segment[1]) f.write(output) # TODO: NEED TO REMOVE THE AUDIO FILES THAT ARE NOT NEEDED BUT CREATED os.remove(raw_file) print "Finished Processing Video: %s" % file_id
rseed = options.seed filename = options.input output_file = options.output bv_count = options.bvectors print 'Reading data' f = gzip.GzipFile(filename) if options.params: f2 = open(options.params) regparam = readParameters(f2) regparam = 2**regparam f2.close() else: regparam = options.regparam print "Chosen regularization parameter", regparam print "Reading data" identities, datavector, Y, fspace_dim = FileReader.readData(f, "l") f.close() print "data read in" tsetsize = len(datavector) if bv_count > tsetsize: bv_count = tsetsize #Sparse version is created next random.seed(rseed) indices = range(tsetsize) #As experimentally shown by Rifkin, random sampling #seems to be as good way of choosing basis vectors as any includedindices = random.sample(indices, bv_count) includedindices.sort() print "Generating kernel matrix" #We create a basis_vectors*training_set sized kernel matrix
import os.path, sys sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)) import FileReader goodFileCoordinates = FileReader.parseCoreLog('coreFileErrorTestGoodFile.log', 0, 0) print 'Test 1:', '\n', 'core file successfully parsed. number of entries: ', len(goodFileCoordinates), '\n' print 'Test 2:' FileReader.parseCoreLog('coreFileErrorTestBadFile.log', 0, 0) print '\nTest 3:' FileReader.parseCoreLog('this_is_not_a_file.log', 0, 0) print '\nTest 4:' try: FileReader.parseCoreLog(None, 0, 0) except (TypeError), e: print 'None value error handled successfully' try: FileReader.parseCoreLog(3, 0, 0) except (TypeError), e: print 'int value error handled successfully'
def __init__(self, filename): self.__jumlah_conflict = 0 self.__jumlah_conflict1 = 0 self.__jumlah_conflict2 = 0 self.__list_of_ruangan = [] self.__list_of_jadwal = [] FR1 = FileReader(filename) FR1.openFile() FR1.splitList() FR1.parseInfo() FR1.formatListType() for item in FR1.getListOfRuangan(): self.__list_of_ruangan.append( Ruangan(item[0], item[1], item[2], item[3])) for item in FR1.getListOfJadwal(): self.__list_of_jadwal.append( Jadwal(item[0], item[1], item[2], item[3], item[4], item[5])) CSP.__count += 1
def create_window(self, puzzle_name): t = tk.Toplevel(self) t.wm_title("Puzzle: %s" % puzzle_name) content = fileReader.read_file(puzzle_name) puzzle_pieces_and_board = self.get_puzzle_pieces(content) puzzle_pieces = puzzle_pieces_and_board[0] game_board = puzzle_pieces_and_board[1] board = tk.Canvas(t, bg="grey", height=350, width=600) color = ["red", "orange", "yellow", "green", "blue", "violet"] # random.choice(color) board.button = tk.Button( t, text="Solve Puzzle", command=lambda puzzle_pieces=puzzle_pieces, game_board=game_board: self.solve_puzzle(puzzle_pieces, game_board) ) board.button.pack(side="top") org_x1 = 10 org_x2 = 20 org_x3 = 20 org_x4 = 10 x1 = org_x1 y1 = 10 x2 = org_x2 y2 = 10 x3 = org_x3 y3 = 20 x4 = org_x4 y4 = 20 value1 = '' value2 = '' for line in content: for letter in line: if letter == ' ': board.create_polygon( x1, y1, x2, y2, x3, y3, x4, y4, fill='grey' ) elif(letter == value1): board.create_polygon( x1, y1, x2, y2, x3, y3, x4, y4, fill='black' ) elif(letter == value2): board.create_polygon( x1, y1, x2, y2, x3, y3, x4, y4, fill='white' ) elif(letter != value1 and letter != value2 and value1 == ''): value1 = letter board.create_polygon( x1, y1, x2, y2, x3, y3, x4, y4, fill='black' ) elif(letter != value1 and letter != value2 and value2 == ''): value2 = letter board.create_polygon( x1, y1, x2, y2, x3, y3, x4, y4, fill='white' ) x1 = x1 + 10 x2 = x2 + 10 x3 = x3 + 10 x4 = x4 + 10 y1 = y1 + 10 y2 = y2 + 10 y3 = y3 + 10 y4 = y4 + 10 x1 = org_x1 x2 = org_x2 x3 = org_x3 x4 = org_x4 board.pack() board.pack(side="top", fill="both", expand=True, padx=50, pady=50)
from shutil import copyfile import Util import PredictionToolExecuter import PredictionToolWriter import PredictionToolReader import FileReader paramToValue = Util.readConfigFile(Util.TOOL_CONFIG, "General") nonphospho = bool(paramToValue["nonphospho"]) Util.cleanUp() # create RMatrix with matches of modified phosphosites FileReader.modifyPeptides() # read matches (modified) or all files in dir allRefMat = PredictionToolWriter.readReference(Util.PATH_TO_TRAIN_REF) # take MATCHES.txt and create train & test files if PATH_TO_TEST+empty) #if matches are aktivated, zur zeit nicht # create random_trainset and testset with RT PredictionToolWriter.createSampleFile(Util.PATH_TO_TRAIN_REF) # create matrix out of file; HEADER! oder mit writeMatrix, dann header weg trainMatrix = PredictionToolWriter.readReference(Util.PATH_TRAIN_TMP) trainMatrix = PredictionToolReader.modifyRetentionTimes(trainMatrix) tools = ["Elude", "SSRCalc", "BioLCCC"] for tool in tools: PredictionToolWriter.writeTrainInput(trainMatrix, Util.PATH_TO_TMP, tool) #neue spalte einfuegen mit ID als sseq mit RT (toolinputseq zeigt auf modifi.Seq) #problem: ssrcalc nur unmodifizierte seq, rest mit -1
def getNotCalled(self, funcNames, contentNames): cpy = funcNames.copy() cpyContent = contentNames.copy() filt = Filter(self.directory, self.getAllPkg(funcNames, contentNames)) javaFiles = filt.execute() self.maxFiles = len(javaFiles) for file in javaFiles: self.loading() packagesImported = [] fileReader = FileReader(file) line, tok = fileReader.getNextInstruction() while line != '': # Get all packages in file if 'import ' in line: packagesImported.append( line.split(' ')[1].split(';')[0].strip()) else: ''' FUNCNAMES ''' for elem in cpy: funcName = elem[0].split('(')[0].split('.')[-1] package = elem[0].split('(')[0] # Get all packages extension packageList = self.extractPkgNames(package) # Check if function and package are in the file if (((funcName + '(' or funcName + ' (') in line) and self.packageIsIn(packageList, packagesImported)): funcNames.remove(elem) # remove also other functions with the same permission listPerm = elem[-1].split(', ') for f in cpy: for perm in listPerm: if perm in f[-1]: try: funcNames.remove(f) except: pass cpy = funcNames ''' CONTENTNAMES ''' for elem in cpyContent: cName = elem[1] package = elem[0] # Get all packages extension packageList = self.extractPkgNames(package) # Check if content and package are in the file if ((cName in line) and self.packageIsIn( packageList, packagesImported)): contentNames.remove(elem) # remove also other functions with the same permission for f in cpyContent: if elem[-1] == f[-1]: try: contentNames.remove(f) except: pass cpyContent = contentNames line, tok = fileReader.getNextInstruction() fileReader.close() permissions = [] for e in funcNames: permissions.append(e[-1]) for e in contentNames: permissions.append(e[-1]) return permissions
maxC = coins maxP = p return maxP def findCurPos(symbol,matrix): return [(index, row.index(symbol)) for index, row in enumerate(matrix) if symbol in row] # parsing parser = argparse.ArgumentParser(description="Marios findShortestPath",conflict_handler="resolve") parser.add_argument('-p', '--player', required=True, help='symbol of player') parser.add_argument('-b', '--board', required=True, help='Path to file that contains the board encoded as text.') parser.add_argument('-h', '--history', required=True, help='history file path') args = parser.parse_args() currentBoard = FileReader.readBoard(args.board) '''BoardInfo Properties # c == after all coins are collected; d == after one player has 10 coins (infinite coins) StopCriterion = c or p MaximalCoins = int RemainingCoins = int PlayerCoins = {} PlayerPositions = {} PlayerList = [] Map = [[]] ''' matrix = currentBoard.Map enemyPos = currentBoard.PlayerPositions[getPlayerWithMostCoins(currentBoard)] posPlayer = currentBoard.PlayerPositions[args.player] ownCoins = currentBoard.PlayerCoins[args.player]
IsGridInitialized=False def onGridInitialized(): """ callback function for the GUI thread. It is called after the grid is initialized and before the TK mainloop has been started. (this is before something is visible) """ global IsGridInitialized IsGridInitialized=True if __name__ == '__main__': gui = GUI(onGridInitialized) #gui.loadMap("../boards/testBoard.txt") gui.Map = FileReader.readMap("../boards/testBoard.txt") gui.start() #start separate GUI thread and wait for the grid to be initialized while(not IsGridInitialized): time.sleep(0.1) time.sleep(0.1) gui.addCoinToCell((0,1)) time.sleep(0.1) gui.addCoinToCell((0,2)) time.sleep(0.1) gui.removeItemFromCell((0,1)) numberOfPlayers = gui.getMaxPlayers() playerIndex = 0
def loadMap(self,fileName): self.Map = FileReader.readMap(fileName)
import Decoder.LibpcapDecoder import Decoder.ModifiedTcpdumpDecoder import Decoder.PcapngDecoder import Decoder.SnoopDecoder import Decoder.NokiaTcpdumpDecoder import Decoder.NanosecondLibpcapDecoder import Decoder.RedHatTcpdumpDecoder import Decoder.SeSETcpdumpDecoder import Decoder.FiveviewDecoder import FileReader all_file_list = [] convert_file_list = [] FileReader.file_reader(all_file_list, convert_file_list) def type_check(infile, file_name): file_type = os.path.splitext(infile)[1] if file_type == ".txt": return False elif file_type == ".pcapng": Decoder.PcapngDecoder.decoder(infile, file_name) return True elif file_type == ".pcap": file_check(infile, file_name) return True elif file_type == ".snoop": Decoder.SnoopDecoder.decoder(infile, file_name) elif file_type == ".5vw":
def check(self, sourceFile): sourceString = FileReader.readFile(args.config) return self.doStringCheck(sourceString)
if not options.output: optparser.error("No output file defined") return options, args if __name__=="__main__": options, args = getOptions() instance_file = options.input model_file = options.model output_file = options.output f = open(model_file) W = f.readline().strip().split() W = [float(x) for x in W] f.close() f = gzip.GzipFile(instance_file) identities, datavector, Y, feaspace_dim = FileReader.readData(f, 'l') f.close() outputs = [] for instance in datavector: prediction = 0. for key in instance.keys(): value = instance[key] prediction += value*W[key] outputs.append(prediction) f = open(output_file, 'w') for identity, prediction, correct in zip(identities, outputs, Y): correct = correct[0,0] f.write("%s %f %f\n" %(identity, correct, prediction)) f.close()
if (xc >= rowMax) and (x == 0): bestOption = 'N' if (y >= colMax) and (yc == 0): bestOption = 'E' if (yc >= colMax) and (y == 0): bestOption = 'W' return bestOption if __name__ == "__main__": args = parser.parse_args() Name = args.player BoardFile = args.boardFile HistoryFile = args.historyFile currentBoard = FileReader.readBoard(BoardFile) '''BoardInfo Properties # c == after all coins are collected; d == after one player has 10 coins (infinite coins) StopCriterion = c or p MaximalCoins = int RemainingCoins = int PlayerCoins = {} PlayerPositions = {} PlayerList = [] Map = [[]] ''' matrix = currentBoard.Map graph = matrixToGraph(matrix) enemyPos = getPlayerPosWithMostCoins(currentBoard) posPlayer = currentBoard.PlayerPositions[Name]
''' Project Name: Final CIS 210 M Program Name: Driver_v2.0.py Date: 10 November 2020 Synopsis: This is a driver program Written by: Iuliia lavine ''' import Setup as sp import FileReader as fr import os import sys fr.readFile(sp.getWelcome()) os.system('cls') class Menu: #Display a menu and respond to choices when run def __init__(self): self.choices = { "W": self.welcome, "Y": self.main_menu, "F": self.factor, "L": self.lists, "I": self.postfix, "Q": self.queue, "R": self.array, "T": self.timer, "Z": self.exit }