Пример #1
0
 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
def capture_solution():
    board = _state_investigator.get_capture()
    if board is None:
        return tuple()
    steps = capture.capture(board)
    return steps
Пример #3
0
def test_solution(board_string):
    board = Board(board_string)
    for summary in capture.capture(board):
        print summary.action