

def  _snake_case		(snake_case_					:     int    ,       snake_case_					:     int    ,       snake_case_					:     int    ,       snake_case_					:     int  )							->		int:
  return len_board * len_board_column * row + column





def  _snake_case		(snake_case_					:     list[list[str]]    ,       snake_case_					:     str    ,       snake_case_					:     int    ,       snake_case_					:     int    ,       snake_case_					:     int    ,       snake_case_					:     set[int]    ,       )							->		bool:

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

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

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

    __UpperCAmelCase	:  Optional[int]		=     get_point_key(snake_case_    ,       snake_case_    ,       snake_case_    ,       snake_case_  )
    if key in visited_points_set:
      continue

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

    visited_points_set.remove(snake_case_  )

  return False





def  _snake_case		(snake_case_					:     list[list[str]]    ,       snake_case_					:     str  )							->		bool:
  __UpperCAmelCase	:  int		=     (
      'The board should be a non empty matrix of single chars strings.'
  )

  __UpperCAmelCase	:  Union[str, Any]		=     len(snake_case_  )
  if not isinstance(snake_case_    ,       snake_case_  ) or len(snake_case_  ) == 0:
    raise ValueError(snake_case_  )

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

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

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

  __UpperCAmelCase	:  Any		=     len(board[0]  )
  for i in range(snake_case_  ):
    for j in range(snake_case_  ):
      if exits_word(
          snake_case_    ,       snake_case_    ,       snake_case_    ,       snake_case_    ,       0    ,       {get_point_key(snake_case_    ,       snake_case_    ,       snake_case_    ,       snake_case_  )}  ):
        return True

  return False


if __name__ == "__main__":
      import doctest

      doctest.testmod()






import hashlib
import importlib.util
import json
import os
import pathlib
from types import ModuleType

import pytest
import requests

__lowerCamelCase     :					Optional[Any]				  =						pathlib.Path.cwd().joinpath('''project_euler''')
__lowerCamelCase     :					Dict				  =						pathlib.Path.cwd().joinpath(
    '''scripts''', '''project_euler_answers.json'''
)

with open(PROJECT_EULER_ANSWERS_PATH) as file_handle:
   __lowerCamelCase     :					dict[str, str]				  =						json.load(file_handle)



def       __SCREAMING_SNAKE_CASE    (   __UpperCamelCase       :			pathlib.Path      )				->   ModuleType:







  """simple docstring"""





  SCREAMING_SNAKE_CASE__     				= importlib.util.spec_from_file_location(file_path.name					,	str(__UpperCamelCase      )      )
  SCREAMING_SNAKE_CASE__     				= importlib.util.module_from_spec(__UpperCamelCase      )  # type: ignore
  spec.loader.exec_module(__UpperCamelCase      )  # type: ignore
  return module



def       __SCREAMING_SNAKE_CASE    (   )				->   list[pathlib.Path]:







  """simple docstring"""





  SCREAMING_SNAKE_CASE__     				= []
  for problem_dir_path in PROJECT_EULER_DIR_PATH.iterdir():
    if problem_dir_path.is_file() or problem_dir_path.name.startswith("""_"""      ):
      continue
    for file_path in problem_dir_path.iterdir():
      if file_path.suffix != ".py" or file_path.name.startswith(("""_""", """test""")      ):
        continue
      solution_file_paths.append(__UpperCamelCase      )
  return solution_file_paths



def       __SCREAMING_SNAKE_CASE    (   )				->   str:







  """simple docstring"""





  with open(os.environ["""GITHUB_EVENT_PATH"""]      ) as file:
    SCREAMING_SNAKE_CASE__     				= json.load(__UpperCamelCase      )
  return event["pull_request"]["url"] + "/files"



def       __SCREAMING_SNAKE_CASE    (   )				->   list[pathlib.Path]:







  """simple docstring"""





  SCREAMING_SNAKE_CASE__     				= []
  SCREAMING_SNAKE_CASE__     				= {
      """Accept""": """application/vnd.github.v3+json""",
      """Authorization""": """token """ + os.environ["""GITHUB_TOKEN"""],
  }
  SCREAMING_SNAKE_CASE__     				= requests.get(get_files_url()					,	headers=__UpperCamelCase      ).json()
  for file in files:
    SCREAMING_SNAKE_CASE__     				= pathlib.Path.cwd().joinpath(file["""filename"""]      )
    if (
        filepath.suffix != ".py"
        or filepath.name.startswith(("""_""", """test""")      )
        or not filepath.name.startswith("""sol"""      )
    ):
      continue
    solution_file_paths.append(__UpperCamelCase      )
  return solution_file_paths



def       __SCREAMING_SNAKE_CASE    (   )				->   list[pathlib.Path]:







  """simple docstring"""





  if os.environ.get("""CI"""      ) and os.environ.get("""GITHUB_EVENT_NAME"""      ) == "pull_request":
    # Return only if there are any, otherwise default to all solutions
    if filepaths := added_solution_file_path():
      return filepaths
  return all_solution_file_paths()






@pytest.mark.parametrize(
    """solution_path"""					,	collect_solution_file_paths()					,	ids=lambda __UpperCamelCase      : f"""{path.parent.name}/{path.name}"""					,	)
def       __SCREAMING_SNAKE_CASE    (   __UpperCamelCase       :			pathlib.Path      )				->   None:







  """simple docstring"""





  SCREAMING_SNAKE_CASE__     				= solution_path.parent.name[8:].zfill(3      )
  SCREAMING_SNAKE_CASE__     				= PROBLEM_ANSWERS[problem_number]
  SCREAMING_SNAKE_CASE__     				= convert_path_to_module(__UpperCamelCase      )
  SCREAMING_SNAKE_CASE__     				= str(solution_module.solution()      )  # type: ignore
  SCREAMING_SNAKE_CASE__     				= hashlib.shaaaa(answer.encode()      ).hexdigest()
  assert (
      answer == expected
  ), f"""Expected solution to {problem_number} to have hash {expected}, got {answer}"""
