def test_resume_solution(): testname = "With RunIndef" fcs = FC_Solve() limit = 10 fcs.limit_iterations(limit) ret = fcs.solve_board( """4C 2C 9C 8C QS 4S 2H 5H QH 3C AC 3H 4H QD QC 9S 6H 9H 3S KS 3D 5D 2S JC 5C JH 6D AS 2D KD TH TC TD 8D 7H JS KH TS KC 7C AH 5S 6S AD 8H JD 7S 6C 7D 4D 8S 9D """) iters_count_ok = 1 while (ret == 5): if (fcs.get_num_times() != limit): iters_count_ok = 0 limit += 10 fcs.limit_iterations(limit) ret = fcs.resume_solution() # TEST ok (ret == 0, "State was successfully solved.") # TEST ok (iters_count_ok == 1, "Iters count was OK throughout the solution.")
def _out_deal(self, deal): board_s = self.game.calc_deal_string(deal, self.rend) sys.stdout.write(board_s) obj = FC_Solve() obj.input_cmd_line__generic(['-l', 'lg']) obj.limit_iterations(100000) if obj.solve_board(board_s) == 0: move = obj.get_next_move() while move: print([ord(move.s[x]) for x in range(4)]) move = obj.get_next_move() # obj.__destroy__() obj = None
def run(self): """docstring for run""" idxs = self.idxs obj = FC_Solve() obj.input_cmd_line(['-l', 'lg']) obj.limit_iterations(100000) self.obj = obj while len(idxs): i = idxs.pop(0) if i == 'seq': start = int(idxs.pop(0)) end = int(idxs.pop(0)) for deal in range(start, end + 1): self._out_deal(deal) elif i == 'slurp': for line in open(idxs.pop(0), 'rt'): self._out_deal(int(line)) else: self._out_deal(int(i)) return 0
def test_resume_solution_with_flares(): testname = "-l ve on iterative limiting - " fcs = FC_Solve() step = 1000 hard_limit = 100000 limit = step # TEST*$input_cmd_line fcs.input_cmd_line("video-editing", ['-l', 'video-editing']) fcs.limit_iterations(limit) # MS deal No. 124 ret = fcs.solve_board( """7S AS 2C QS TH QD 7D 5D 8D 9D JH QH 5C JD 6D TD 5H 2S 6S TC KS TS 4S 3D 9C 3C KD 7C 6H 5S 9H 6C KC AH AC 4C 8S 2D QC JS 9S KH 8C 4D 7H 4H 2H 3S 8H AD 3H JC """ ) iters_count_ok = 1 while (ret == 5 and limit < hard_limit): if (fcs.get_num_times() != limit): iters_count_ok = 0 limit += step fcs.limit_iterations(limit) ret = fcs.resume_solution() # TEST ok(ret == 0, testname + "State was successfully solved.") # TEST ok(iters_count_ok == 1, testname + "Iters count was OK throughout the solution.")