Exemple #1
0
def report(message, speak=False, console=True, log=False):
    if console:
        print message
    if speak:
        dragonfly_speak(message)
    if log:
        settings.report_to_file(message)
Exemple #2
0
def report(message, speak=False, console=True, log=False):
    if console:
        print message
    if speak:
        dragonfly_speak(message)
    if log:
        settings.report_to_file(message)
Exemple #3
0
def report(message, speak=False, console=True, log=False):
    import dragonfly
    if console:
        print message
    if speak:
        dragonfly.get_engine().speak(message)
    if log:
        settings.report_to_file(message)
Exemple #4
0
def run_tests():
    original_ccr_max = settings.SETTINGS["miscellaneous"]["max_ccr_repetitions"]
    reports = ["Caster/Dragonfly Grammar Complexity Report v2\n===============================\n\n"]
    start_time = time.time()
    cycle_count = 1

    for i in range(0, 3):
        if i != 0:
            settings.SETTINGS["miscellaneous"]["max_ccr_repetitions"] += 1
        ccr_max = settings.SETTINGS["miscellaneous"]["max_ccr_repetitions"] + 2
        print("Run " + str(i + 1) + " /3")

        not_max_yet = True
        nspecs = 2
        nc_orig = 2
        while not_max_yet:

            for nchoices in range(nc_orig, 500, 4):

                result = test(nspecs, nchoices, ccr_max)
                reports.append(
                    "\ncycles: "
                    + str(cycle_count)
                    + " | ccrm: "
                    + str(result.ccr_max)
                    + " | specs: "
                    + str(result.specs)
                    + " | choice-500s: "
                    + str(result.choices)
                    + " | elements: "
                    + str(result.elements)
                    + " | broke: "
                    + str(result.broke)
                    + "\n"
                )
                cycle_count += 1
                if result.broke:
                    nspecs += 2

                    reports.append(result.report + "\n")

                    """if choices max out at 1, the test is over"""
                    if result.choices == nc_orig:
                        not_max_yet = False
                    break

    reports.append("\nSettings JSON CCR Max Reps: " + str(original_ccr_max) + "\n")
    reports.append("Total time for test: " + str(int(time.time() - start_time)) + " sec\n\n")
    result = "".join(reports)
    report_path = settings.SETTINGS["paths"]["BASE_PATH"] + "/bin/data/complexity_report_" + str(time.time()) + ".txt"
    print("Report saved to " + report_path)
    settings.report_to_file(result, report_path)

    settings.SETTINGS["miscellaneous"]["max_ccr_repetitions"] = original_ccr_max
Exemple #5
0
def run_tests():
    original_ccr_max = settings.SETTINGS["miscellaneous"][
        "max_ccr_repetitions"]
    reports = [
        "Caster/Dragonfly Grammar Complexity Report v2\n===============================\n\n"
    ]
    start_time = time.time()
    cycle_count = 1

    for i in range(0, 3):
        if i != 0:
            settings.SETTINGS["miscellaneous"]["max_ccr_repetitions"] += 1
        ccr_max = settings.SETTINGS["miscellaneous"]["max_ccr_repetitions"] + 2
        print("Run " + str(i + 1) + " /3")

        not_max_yet = True
        nspecs = 2
        nc_orig = 2
        while not_max_yet:

            for nchoices in range(nc_orig, 500, 4):

                result = test(nspecs, nchoices, ccr_max)
                reports.append("\ncycles: "+str(cycle_count)\
                               +" | ccrm: "+str(result.ccr_max)\
                               +" | specs: "+str(result.specs)\
                               +" | choice-500s: "+str(result.choices)\
                               +" | elements: "+str(result.elements)\
                               +" | broke: "+str(result.broke)\
                               +"\n")
                cycle_count += 1
                if result.broke:
                    nspecs += 2

                    reports.append(result.report + "\n")
                    '''if choices max out at 1, the test is over'''
                    if result.choices == nc_orig: not_max_yet = False
                    break

    reports.append("\nSettings toml CCR Max Reps: " + str(original_ccr_max) +
                   "\n")
    reports.append("Total time for test: " +
                   str(int(time.time() - start_time)) + " sec\n\n")
    result = "".join(reports)
    report_path = settings.SETTINGS["paths"][
        "BASE_PATH"] + "/bin/data/complexity_report_" + str(
            time.time()) + ".txt"
    print("Report saved to " + report_path)
    settings.report_to_file(result, report_path)

    settings.SETTINGS["miscellaneous"][
        "max_ccr_repetitions"] = original_ccr_max