Example #1
0
def main():
	"""
	**********************************************************************************************************************
	Run on file execution
	"""
	# puzzle_name = WEEK[3]
	# puzzle_name = 'oct0515'
	# puzzle_name = 'dec3014'
	# puzzle_name = 'jan2710'

	## record puzzles done so far ##
	with open( 'done3.txt', 'r' ) as done_file:
		done = done_file.read().splitlines()
	done_file.close()


	for puzzle_name in os.listdir( 'puzzles3/' ):

		## avoid hidden files and previously solved ones ##
		if len( puzzle_name ) != 7 or puzzle_name in done:
			continue
		puzzle_solver.fill( puzzle_name )
		diff = evaluate.compare_results( puzzle_name )
		evaluate.score_puzzle( diff )
		with open( 'done3.txt', 'a' ) as done_file:
			done_file.write( puzzle_name + '\n' )
		done_file.close()
Example #2
0
def main():
    """
	**********************************************************************************************************************
	Run on file execution
	"""
    # puzzle_name = WEEK[3]
    # puzzle_name = 'oct0515'
    # puzzle_name = 'dec3014'
    # puzzle_name = 'jan2710'

    ## record puzzles done so far ##
    with open('done2.txt', 'r') as done_file:
        done = done_file.read().splitlines()
    done_file.close()

    for puzzle_name in os.listdir('puzzles2/'):

        ## avoid hidden files and previously solved ones ##
        if len(puzzle_name) != 7 or puzzle_name in done:
            continue
        puzzle_solver.fill(puzzle_name)
        diff = evaluate.compare_results(puzzle_name)
        evaluate.score_puzzle(diff)
        with open('done2.txt', 'a') as done_file:
            done_file.write(puzzle_name + '\n')
        done_file.close()
Example #3
0
def score_all_puzzles():
	"""
	**********************************************************************************************************************

	"""
	scores = [ [], [], [], [], [], [], [] ]
	avgs = [ [ 0, 0 ], [ 0, 0 ], [ 0, 0 ], [ 0, 0 ], [ 0, 0 ], [ 0, 0 ], [ 0, 0 ] ]
	num_puzzles = [ 0, 0, 0, 0, 0, 0, 0 ]
	max_scores = [ [ 0, '' ], [ 0, '' ], [ 0, '' ], [ 0, '' ], [ 0, '' ], [ 0, '' ], [ 0, '' ] ]
	min_scores = [ [ 100, '' ], [ 100, '' ], [ 100, '' ], [ 100, '' ], [ 100, '' ], [ 100, '' ], [ 100, '' ] ]

	for puzzle_name in os.listdir( 'puzzles/' ):

		## avoid hidden files ##
		if len( puzzle_name ) != 7:
			continue
		try:
			diff = evaluate.compare_results( puzzle_name )
			letters_correct, words_correct = evaluate.score_puzzle( diff )
			day = os.listdir( 'puzzles/' + puzzle_name )[0][1:-4]

			day_min = min_scores[ DAYS.index( day ) ][0]
			if words_correct < day_min:
				min_scores[ DAYS.index( day ) ][0] = words_correct
				min_scores[ DAYS.index( day ) ][1] = puzzle_name

			# day_max = max_scores[ DAYS.index( day ) ][0]
			# if letters_correct > day_max and letters_correct < 99:
			# 	max_scores[ DAYS.index( day ) ][0] = letters_correct
			# 	max_scores[ DAYS.index( day ) ][1] = puzzle_name

			scores[ DAYS.index( day ) ].append( [ round( letters_correct, 2 ), round( words_correct, 2 ) ] )
		except:
			print( 'puzzle not solved yet' )

	for score in min_scores:
		print( score[0] )

	with open( 'scores.txt', 'w' ) as scores_file:

		scores_file.write( '# LETT\tWORDS\n' )
		for i in range( len( scores ) ):
			scores_file.write( '# ' + DAYS[i] + '\n' )

			for puzzle in scores[i]:
				scores_file.write( str( puzzle[0] ) + '\t' + str( puzzle[1] ) + '\n' )
				avgs[i][0] += puzzle[0]
				avgs[i][1] += puzzle[1]
				num_puzzles[i] += 1

	scores_file.close()

	with open( 'scores-avg.txt', 'w' ) as avg_scores_file:
		for i in range( len( scores ) ):
			avg_scores_file.write( '# ' + DAYS[i] + '\n' )
			avg_scores_file.write( str( round( avgs[i][0] / num_puzzles[i], 2 ) ) + '\t' + str( round( avgs[i][1] / num_puzzles[i], 2 ) ) + '\n' )
	avg_scores_file.close()
Example #4
0
def main():
    """
	**********************************************************************************************************************
	Run on file execution
	"""

    args = sys.argv
    downloads = False
    allPuzzles = False

    if len(args) == 1:  # no flags
        pass
    elif args[1] == '-d' or args[1] == '--downloads':
        downloads = True
    elif args[1] == '-a' or args[1] == '--all':
        allPuzzles = True

    if downloads:  # pull latest puzzle from downloads

        ## parse the puzzle out of downloads ##
        os.system('./single_parser.rb')
        with open('log.txt', 'r') as log_file:
            puzzle_name = log_file.readline()
        log_file.close()

        ## solve the puzzle ##
        puzzle_solver.fill(puzzle_name)
        diff = evaluate.compare_results(puzzle_name)
        evaluate.score_puzzle(diff)

    elif allPuzzles:  # test all puzzles
        ## record puzzles done so far ##
        with open('done.txt', 'r') as done_file:
            done = done_file.read().splitlines()
        done_file.close()

        for puzzle_name in os.listdir('puzzles/'):

            ## avoid hidden files and previously solved ones ##
            if len(puzzle_name) != 7 or puzzle_name in done:
                continue
            puzzle_solver.fill(puzzle_name)
            diff = evaluate.compare_results(puzzle_name)
            evaluate.score_puzzle(diff)
            with open('done.txt', 'a') as done_file:
                done_file.write(puzzle_name + '\n')
            done_file.close()

    else:  # do a single puzzle
        # puzzle_name = WEEK[0]
        # puzzle_name = 'oct0515'
        # puzzle_name = 'dec3014'
        puzzle_name = 'jan2710'
        puzzle_solver.fill(puzzle_name)
        diff = evaluate.compare_results(puzzle_name)
        evaluate.score_puzzle(diff)
Example #5
0
def main():
    """
	**********************************************************************************************************************
	Run on file execution
	"""

    args = sys.argv
    downloads = False
    allPuzzles = False

    if len(args) == 1:  # no flags
        pass
    elif args[1] == "-d" or args[1] == "--downloads":
        downloads = True
    elif args[1] == "-a" or args[1] == "--all":
        allPuzzles = True

    if downloads:  # pull latest puzzle from downloads

        ## parse the puzzle out of downloads ##
        os.system("./single_parser.rb")
        with open("log.txt", "r") as log_file:
            puzzle_name = log_file.readline()
        log_file.close()

        ## solve the puzzle ##
        puzzle_solver.fill(puzzle_name)
        diff = evaluate.compare_results(puzzle_name)
        evaluate.score_puzzle(diff)

    elif allPuzzles:  # test all puzzles
        ## record puzzles done so far ##
        with open("done.txt", "r") as done_file:
            done = done_file.read().splitlines()
        done_file.close()

        for puzzle_name in os.listdir("puzzles/"):

            ## avoid hidden files and previously solved ones ##
            if len(puzzle_name) != 7 or puzzle_name in done:
                continue
            puzzle_solver.fill(puzzle_name)
            diff = evaluate.compare_results(puzzle_name)
            evaluate.score_puzzle(diff)
            with open("done.txt", "a") as done_file:
                done_file.write(puzzle_name + "\n")
            done_file.close()

    else:  # do a single puzzle
        # puzzle_name = WEEK[0]
        # puzzle_name = 'oct0515'
        # puzzle_name = 'dec3014'
        puzzle_name = "jan2710"
        puzzle_solver.fill(puzzle_name)
        diff = evaluate.compare_results(puzzle_name)
        evaluate.score_puzzle(diff)
Example #6
0
def main():
	puzzle_solver.fill( puzzle_name )
	diff = evaluate.compare_results( puzzle_name )
	evaluate.score_puzzle( diff )