Exemple #1
0
            sys.stdout.write(
                "Writing to file, value for: %s" %
                (currentDir + currentFile + '-' + str(run).zfill(file_dec)))
            sys.stdout.flush()

            if run == 0:
                if first == 1:
                    first = 0
                    if mark == '!':
                        output = "!0"
                    else:
                        output = "0"
                else:
                    output = hexWrapper.runHex(
                        str(path - 1) + str(10**file_dec - 1) +
                        ''.zfill(run_dec), str(color),
                        str(path) + str(run).zfill(file_dec) +
                        ''.zfill(run_dec))
            else:
                output = hexWrapper.runHex(
                    str(path) + str(run - 1).zfill(file_dec) +
                    ''.zfill(run_dec), str(color),
                    str(path) + str(run).zfill(file_dec) + ''.zfill(run_dec))
            print(" - Done")

            # Add mark in case the startpoint is not 0
            output = mark + str(output) + '\n'

            f = open(currentDir + currentFile, "a+")
            f.write("%s" % output)
            f.close()
Exemple #2
0
import hexWrapper

current = 0
color = 0
while True:
	f = open("./bigHexFile.txt","a+")
	f.write("%s" % str(color) + "\n")
	f.close()
	color = hexWrapper.runHex(str(current),str(color),str(current+10**11),0,False)
	current = current+10**11
        flag = "~"

        sys.stdout.write("Writing to file, value starting at: %s\n" %
                         currentPath)
        if os.path.exists(os.path.join("./temp", currentPath + ".txt" + flag)):
            os.remove(os.path.join("./temp", currentPath + ".txt" + flag))
        if os.path.exists(os.path.join(args.outputDir, currentPath + ".txt")):
            break  # if the file already has been generated then this program is finished
        for lineNum in range(10**2 + 1):
            #sys.stdout.write( "Writing to file, value for: %s\n" % (str(lineNum).zfill(file_dec)))
            sys.stdout.flush()
            if lineNum == 0:
                color = 0
            elif lineNum == 100:
                color = hexWrapper.runHex(
                    str(path) + str(99) + ''.zfill(run_dec), str(color),
                    str(path + 1) + '00' + ''.zfill(run_dec), args.gpu)
            else:
                color = hexWrapper.runHex(
                    str(path) + str(lineNum - 1).zfill(2) + ''.zfill(run_dec),
                    str(color),
                    str(path) + str(lineNum).zfill(2) + ''.zfill(run_dec),
                    args.gpu)

            print("Line: ", lineNum, "Color: ", color)

            f = open(os.path.join("./temp", currentPath + ".txt" + flag), "a+")
            f.write("%s" % str(color) + '\n')
            f.close()

        print("moving " + os.path.join("./temp", currentPath + ".txt" + flag) +
Exemple #4
0
    if not os.path.exists(args.outputDir):
	os.makedirs(args.outputDir)

    def generateFile(outputDirectory, lineIncrement, fileName):
	color = 0

	sys.stdout.write( "Writing to file, value starting at: %s\n" % str(fileName))
	if os.path.exists(os.path.join("./temp",fileName + ".txt~")):
	    os.remove(os.path.join("./temp",fileName + ".txt~"))
        f = open(os.path.join("./temp", fileName + ".txt~"), "a+")
        f.write(str(color)) + '\n')
        f.close()
	for lineNum in range(1,10**2+1):
	    sys.stdout.flush()
	    output = hexWrapper.runHex(str(fileName)+str(lineNum-1).zfill(2)+''.zfill(lineIncrement),
	        str(color),
		str(fileName)+str(lineNum).zfill(2)+''.zfill(lineIncrement))

	    print("New color: ", output)
	    color = output

	    f = open(os.path.join("./temp", fileName + ".txt~"), "a+")
	    f.write("%s" % str(output) + '\n')
	    f.close()
	
	print("moving " + os.path.join("./temp", fileName + ".txt~") + " to " + os.path.join(outputDirectory, fileName + ".txt~"))
	# rename temporary file to final filename once finished
	os.rename(os.path.join("./temp", fileName + ".txt~"), os.path.join(outputDirectory, fileName + ".txt~"))

	return { "success": True, "message": "File " + str(fileName) + ".txt~ created. Saved to directory: " + outputDirectory }