def _play(black_policy_fn, white_policy_fn, board_size=19):
 moves = []
 (prev_state, prev_action) = (None, None)
 curr_state = GoState(pachi_py.CreateBoard(board_size), BLACK)
 while (not curr_state.board.is_terminal):
  a = (black_policy_fn if (curr_state.color == BLACK) else white_policy_fn)(curr_state, prev_state, prev_action)
  next_state = curr_state.act(a)
  moves.append((curr_state, a, next_state))
  (prev_state, prev_action) = (curr_state, a)
  curr_state = next_state
 return moves

def _play ( black_policy_fn , white_policy_fn , board_size = 19 ) : moves = [ ] ( prev_state , prev_action ) = ( None , None ) curr_state = GoState ( pachi_py . CreateBoard ( board_size ) , BLACK ) while ( not curr_state . board . is_terminal ) : a = ( black_policy_fn if ( curr_state . color == BLACK ) else white_policy_fn ) ( curr_state , prev_state , prev_action ) next_state = curr_state . act ( a ) moves . append ( ( curr_state , a , next_state ) ) ( prev_state , prev_action ) = ( curr_state , a ) curr_state = next_state return moves
samples a trajectory for two player policies .