--- /dev/null
+import os, errno
+import subprocess
+
+#solver path
+solverpath = "C:\\Users\\Alex Fedotov\\Documents\\Studies\\Model Checking\\Assignments\\Solver\\"
+
+#paths to folders with sokoban screens
+paths = ["C:\\Users\\Alex Fedotov\\Documents\\Studies\\Model Checking\\Assignments\\Sokoban\\screens",
+ ]
+
+#path to output folder (base)
+output = "C:\\Users\\Alex Fedotov\\Documents\\Studies\\Test"
+
+commands = ["C:\\Users\\Alex Fedotov\\Documents\\Studies\\Model Checking\\Assignments\\Solver\\solver.exe"]
+
+boxbound = 3
+sizebound = 60
+timebound = 10
+
+def checkPaths():
+ isOk = True
+ for path in paths:
+ if not os.path.isdir(path):
+ isOk = False
+ print("You specified a wrong path: %s" % path)
+ return isOk
+
+def checkScreen(screenpath):
+ scrSize = 0
+ scrBox = 0
+ with open(screenpath,"r") as src:
+ for line in src:
+ scrSize += len(line.rstrip())
+ scrBox += line.count('$')
+ scrBox += line.count('*')
+ src.close()
+ return boxbound >= scrBox and sizebound >= scrSize
+
+for com in commands:
+ if checkPaths():
+ out = open(output + "\\results.txt", "w")
+ for path in paths:
+ all_rs = os.listdir(path)
+ for test in all_rs:
+ input_path = path + "\\" + test
+ os.makedirs(output, exist_ok=True)
+ os.chdir(solverpath)
+ if checkScreen(input_path):
+ runcommand = []
+ runcommand.append(com)
+ runcommand.append(input_path)
+ #to be continued...
+ proc = subprocess.run(runcommand, stdout=subprocess.PIPE, universal_newlines=True)
+ proc.wait()
+ out.write(test + ":" + proc.stdout)
+ print(test + ":" + proc.stdout)
+ #input("Press enter to continue...")
+ out.close();