(board, pos, current_player)
return flipped
Returns a list of the positions of the pieces to be flipped if
    player `nplayer` places a piece on the `board` at position `pos`.
    This is slow and could be coded in C or Cython.
Returns a list of the positions of the pieces to be flipped if
    player `nplayer` places a piece on the `board` at position `pos`.
    This is slow and could be coded in C or Cython.
Returns a list of the positions of the pieces to be flipped if player nplayer places a piece on the board at position pos . This is slow and could be coded in C or Cython .
def pieces_flipped(board, pos, current_player):
    """
    Returns a list of the positions of the pieces to be flipped if
    player `nplayer` places a piece on the `board` at position `pos`.
    This is slow and could be coded in C or Cython.
    """

    flipped = []

    for d in DIRECTIONS:
        ppos = pos + d
        streak = []
        while (0 <= ppos[0] <= 7) and (0 <= ppos[1] <= 7):
            if board[ppos[0], ppos[1]] == 3 - current_player:
                streak.append(+ppos)
            elif board[ppos[0], ppos[1]] == current_player:
                flipped += streak
                break
            else:
                break
            ppos += d

    return flipped
def pieces_flipped ( board , pos , current_player ) : flipped = [ ] for d in DIRECTIONS : ppos = pos + d streak = [ ] while ( 0 <= ppos [ 0 ] <= 7 ) and ( 0 <= ppos [ 1 ] <= 7 ) : if board [ ppos [ 0 ] , ppos [ 1 ] ] == 3 - current_player : streak . append ( + ppos ) elif board [ ppos [ 0 ] , ppos [ 1 ] ] == current_player : flipped += streak break else : break ppos += d return flipped