original_docstring: The tool searches words in a randomly generated grid of letters.
docstring: The tool searches words in a randomly generated grid of letters.
docstring_tokens: The tool searches words in a randomly generated grid of letters .
code: def _tool_chain(
      grid_size: str = Option(
          default='50x50',
          help=textwrap.dedent(
              'The size for a randomly created grid of letters (a-z only).'
          ),
      ),
      words_file_path: Path = Option(
          default=Path('payload/words.txt'),
          help=textwrap.dedent(
              'A path to a custom text file with words to search.'
          ),
      ),
      words_limit: int = Option(
          default=5,
          help=textwrap.dedent('Search N random words from a given text file.'),
      ),
      word: str = Option(
          default='',
          help=textwrap.dedent(
              'A custom word to search in a grid of letters e.g "foo".'
          ),
      ),
  ) -> None:
      """The tool searches words in a randomly generated grid of letters."""
      grid_height, grid_width = tuple(map(int, grid_size.split('x')))
      _validate_puzzle_grid_size(grid_size)
      with RandomWordsGrid(
          grid_size=GridSize(grid_height, grid_width)
      ) as grid:  # type: Grid
          board = grid.content.to_coordinates()
          if word:
              _validate_puzzle_word(word)
              start_word_search_puzzle(HiddenWord(board, word))
          else:
              _validate_puzzle_words_path(words_file_path)
              random_words = _random_words(
                  path=words_file_path, limit=words_limit
              )
              start_words_search_puzzle(HiddenWords(board, random_words))
code_tokens: def _tool_chain ( grid_size : str = Option ( default = '50x50' , help = textwrap . dedent ( 'The size for a randomly created grid of letters (a-z only).' ) , ) , words_file_path : Path = Option ( default = Path ( 'payload/words.txt' ) , help = textwrap . dedent ( 'A path to a custom text file with words to search.' ) , ) , words_limit : int = Option ( default = 5 , help = textwrap . dedent ( 'Search N random words from a given text file.' ) , ) , word : str = Option ( default = '' , help = textwrap . dedent ( 'A custom word to search in a grid of letters e.g "foo".' ) , ) , ) -> None : grid_height , grid_width = tuple ( map ( int , grid_size . split ( 'x' ) ) ) _validate_puzzle_grid_size ( grid_size ) with RandomWordsGrid ( grid_size = GridSize ( grid_height , grid_width ) ) as grid : board = grid . content . to_coordinates ( ) if word : _validate_puzzle_word ( word ) start_word_search_puzzle ( HiddenWord ( board , word ) ) else : _validate_puzzle_words_path ( words_file_path ) random_words = _random_words ( path = words_file_path , limit = words_limit ) start_words_search_puzzle ( HiddenWords ( board , random_words ) )
short_docstring: The tool searches words in a randomly generated grid of letters.
short_docstring_tokens: The tool searches words in a randomly generated grid of letters .
comment: """The tool searches words in a randomly generated grid of letters."""$SEP$# type: Grid