<jupyter_start><jupyter_text>Maze Solver using Backtracking Tip: obtaining a repository with util funcitons<jupyter_code>!git clone https://github.com/lmcanavals/algorithmic_complexity.git 2>/dev/null
from algorithmic_complexity.aclib.mazebuilder import makeMaze
import matplotlib.pyplot as plt<jupyter_output><empty_output><jupyter_text>Tip: using matplotlib to draw a **maze**, you can experiment with [more colors](https://matplotlib.org/stable/tutorials/colors/colormaps.html)<jupyter_code>def drawMaze(maze):
    fig, ax = plt.subplots(figsize=(18, 18))
    ax.imshow(maze, cmap='viridis') # 
    ax.axis('off')
def mazeSolve(maze, row, col, rowF, colF):
    maze[row][col] = 3              # camino correcto (amarillito)
    if row == rowF and col == colF:
        return True

    for r, c in [(row-1, col), (row, col+1), (row+1, col), (row, col-1)]:
        if maze[r][c] == 1 and mazeSolve(maze, r, c, rowF, colF):
            return True

    maze[row][col] = 2              # camino sin salida (verde)
    return False
maze = makeMaze(5, 10)
drawMaze(maze)
rows, cols = maze.shape # matriz de numpy, sino, sería len(maze), len(maze[0])
mazeSolve(maze, 1, 1, rows - 2, cols -2 )
drawMaze(maze)
maze = makeMaze(60, 120)
drawMaze(maze)
rows, cols = maze.shape
mazeSolve(maze, 1, 1, rows - 2, cols -2 )
drawMaze(maze)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1395864106351551, 'fraction_numerical': 0.02141802067946824, 'mean_word_length': 4.093984962406015, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '226607', 'license': 'CC0-1.0', 'n_tokens_mistral': 554, 'n_tokens_neox': 519, 'n_words': 129, 'path': 'notebooks/ad_backtraking_maze_solver.ipynb', 'repo_name': 'AgustinAMaita/DataSet', 'size': '1354'}