'''simple docstring'''
def 			_UpperCamelCase			(  _a						:						int					,  _a						:						int					,  _a						:						int					,  _a						:						int      ):




    """simple docstring"""



    return len_board * len_board_column * row + column







def 			_UpperCamelCase			(  _a						:						list[list[str]]					,  _a						:						str					,  _a						:						int					,  _a						:						int					,  _a						:						int					,  _a						:						set[int]					,  ):




    """simple docstring"""



    if board[row][column] != word[word_index]:
        return False

    if word_index == len(_a      ) - 1:
        return True

    __UpperCamelCase						:						Optional[int]		     =	[(0, 1), (0, -1), (-1, 0), (1, 0)]
    __UpperCamelCase						:						List[Any]		     =	len(_a      )
    __UpperCamelCase						:						Union[str, Any]		     =	len(board[0]      )
    for direction in traverts_directions:
        __UpperCamelCase						:						Tuple		     =	row + direction[0]
        __UpperCamelCase						:						Optional[int]		     =	column + direction[1]
        if not (0 <= next_i < len_board and 0 <= next_j < len_board_column):
            continue

        __UpperCamelCase						:						int		     =	get_point_key(_a					,  _a					,  _a					,  _a      )
        if key in visited_points_set:
            continue

        visited_points_set.add(_a      )
        if exits_word(_a					,  _a					,  _a					,  _a					,  word_index + 1					,  _a      ):
            return True

        visited_points_set.remove(_a      )

    return False







def 			_UpperCamelCase			(  _a						:						list[list[str]]					,  _a						:						str      ):




    """simple docstring"""



    __UpperCamelCase						:						Any		     =	(
        'The board should be a non empty matrix of single chars strings.'
    )

    __UpperCamelCase						:						Optional[int]		     =	len(_a      )
    if not isinstance(_a					,  _a      ) or len(_a      ) == 0:
        raise ValueError(_a      )

    for row in board:
        if not isinstance(_a					,  _a      ) or len(_a      ) == 0:
            raise ValueError(_a      )

        for item in row:
            if not isinstance(_a					,  _a      ) or len(_a      ) != 1:
                raise ValueError(_a      )

    # Validate word
    if not isinstance(_a					,  _a      ) or len(_a      ) == 0:
        raise ValueError(
            'The word parameter should be a string of length greater than 0.'      )

    __UpperCamelCase						:						Dict		     =	len(board[0]      )
    for i in range(_a      ):
        for j in range(_a      ):
            if exits_word(
                _a					,  _a					,  _a					,  _a					,  0					,  {get_point_key(_a					,  _a					,  _a					,  _a      )}      ):
                return True

    return False


if __name__ == "__main__":
  import doctest

  doctest.testmod()




'''simple docstring'''
from .prime_check import Test

Test()



