Ejemplo n.º 1
0
#!/usr/bin/env python
import pycosat
import test_pycosat

assert test_pycosat.run().wasSuccessful()

assert pycosat.__version__ == '0.6.3'

assert test_pycosat.process_cnf_file('qg3-08.cnf') == 18
assert test_pycosat.process_cnf_file('uf20-098.cnf') == 5

import sudoku
sudoku.test()
Ejemplo n.º 2
0
parser.add_argument('-t', '--test',
                    action='store_true',
                    help='run regression tests')
parser.add_argument('-c', '--deepcopy',
                    action='store_true',
                    help='use deep copy for backtracking')
parser.add_argument('-v', '--verbose',
                    action='store_true',
                    help='more verbose output')
parser.add_argument('-i', '--hint',
                    action='store_true',
                    help='show possible values for given puzzle')
args = parser.parse_args()

if args.test:
    sudoku.test(args.deepcopy)
    quit()

start_time = time.time()
count = 0

# Todo: generate histogram for benchmarked completion times
hist = {}

# load game
puzzles = []
if args.p is not None:
    puzzles.append(args.p)
else:
    # read in a list of puzzles from a file or default to standard in
    input = args.f