aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthecharlesblake2018-01-10 12:12:15 +0000
committerthecharlesblake2018-01-10 12:12:15 +0000
commit6c7a66dd874b4a345c9e78bc36097a88d2dc8ec9 (patch)
tree1ba3f7998224ef9550ddcbbc27aa5e90208d67f8
parentRemove build order from sol rules (diff)
downloadmetasol-6c7a66dd874b4a345c9e78bc36097a88d2dc8ec9.tar.gz
metasol-6c7a66dd874b4a345c9e78bc36097a88d2dc8ec9.zip

Add results table to benchmark script

-rw-r--r--benchmark.py10
1 files changed, 10 insertions, 0 deletions
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)