コード例 #1
0
ファイル: test_capture.py プロジェクト: kobejohn/PQHelper
 def test_capture_on_easy_board_returns_correct_solution(self):
     board_string = '........\n' \
                    '........\n' \
                    '........\n' \
                    '........\n' \
                    '.......x\n' \
                    '....xx.r\n' \
                    '....rr.r\n' \
                    '..rryyry'
     board = Board(board_string)
     solution = capture(board)
     solution_swaps = [summary.action for summary in solution]
     # confirm that the solution matches the specification
     solution_swaps_spec = (((7, 6), (7, 7)), ((7, 6), (7, 7)))
     self.assertSequenceEqual(solution_swaps, solution_swaps_spec,
                              'Expected to get this solution:\n{}\nbut got'
                              ' this:\n{}'
                              ''.format(solution_swaps_spec, solution_swaps))
コード例 #2
0
ファイル: easy.py プロジェクト: kobejohn/PQHelper
def capture_solution():
    board = _state_investigator.get_capture()
    if board is None:
        return tuple()
    steps = capture.capture(board)
    return steps
コード例 #3
0
ファイル: capture_profile.py プロジェクト: kobejohn/PQHelper
def test_solution(board_string):
    board = Board(board_string)
    for summary in capture.capture(board):
        print summary.action