Files
2025-08-03 20:24:38 -07:00

28 lines
662 B
Python

#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
from subprocess import Popen, PIPE
def solveIt(inputData):
process = Popen(['magicSquare.exe', str(inputData)], stdout=PIPE)
(stdout, stderr) = process.communicate()
return stdout.strip()
import sys
if __name__ == "__main__":
if len(sys.argv) > 1:
try:
n = int(sys.argv[1].strip())
except:
print sys.argv[1].strip(), 'is not an integer'
print 'Solving Size:', n
print(solveIt(n))
else:
print('This test requires an instance size. Please select the size of problem to solve. (i.e. python magicSquareSolver.py 3)')