From 6c7a66dd874b4a345c9e78bc36097a88d2dc8ec9 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Wed, 10 Jan 2018 12:12:15 +0000 Subject: Add results table to benchmark script --- benchmark.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'benchmark.py') diff --git a/benchmark.py b/benchmark.py index c00ccce..fa13c7b 100644 --- a/benchmark.py +++ b/benchmark.py @@ -5,6 +5,7 @@ import sys import atexit from subprocess import run, TimeoutExpired, CalledProcessError, DEVNULL from abc import ABCMeta, abstractmethod +from prettytable import PrettyTable tempRulesFilename = "temp_rules.json" timeoutsLimit = 4 @@ -134,6 +135,8 @@ def cleanup(): atexit.register(cleanup) +summaryResults = {} + # Loops through each canonical solitaire for rulesGen in [SpanishPatienceRulesGen(), FreeCellRulesGen(), @@ -184,7 +187,14 @@ for rulesGen in [SpanishPatienceRulesGen(), + " within time constraint\n") print("Game description at level " + str(level) + ":") print(str(rulesGen) + "\n") + summaryResults[rulesGen.name] = level break else: print("Solved " + rulesGen.name + " at level " + str(level) + " ...") + +# Prints results summary table +t = PrettyTable(['Solitaire', 'Level']) +for name, level in summaryResults.items(): + t.add_row([name, level]) +print(t) -- cgit v1.2.1