### Install Pre-commit Hooks Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Set up the pre-commit framework and install the configured Git hooks into the repository. ```bash pre-commit install ``` -------------------------------- ### Install go-maze CLI Source: https://github.com/buko106/go-maze/blob/main/README.md Install the go-maze command-line interface by cloning the repository and running the make install command. Alternatively, build the executable directly. ```bash git clone https://github.com/buko106/go-maze.git cd go-maze make install ``` ```bash go build -o maze . ``` -------------------------------- ### Display Example Maze Outputs with Make Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md View pre-generated examples of maze outputs in various formats. ```bash make examples ``` -------------------------------- ### Install go-maze CLI Source: https://context7.com/buko106/go-maze/llms.txt Clone the repository, navigate to the directory, and use 'make install' or 'go build' to compile the executable. ```bash git clone https://github.com/buko106/go-maze.git cd go-maze make install # or go build -o maze . ``` -------------------------------- ### Install Application Binary with Make Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Build the application and place the executable in the current directory as './maze'. ```bash make install ``` -------------------------------- ### Example ASCII Maze with Solution Path Source: https://github.com/buko106/go-maze/blob/main/README.md Example of a 7x7 maze generated with DFS algorithm, seed 42, in ASCII format, with the solution path displayed. ```bash ./maze -a dfs --seed 42 -s 7 --solution ``` ```text ####### #●#···# #·#·#·# #···#·# #####·# # ○# ####### ``` -------------------------------- ### Example Unicode Maze with Solution Path Source: https://github.com/buko106/go-maze/blob/main/README.md Example of a 7x7 maze generated with DFS algorithm, seed 42, in Unicode format, with the solution path displayed. ```bash ./maze -a dfs --seed 42 -s 7 -f unicode --solution ``` ```text ┌─┬───┐ │◉│•••│ │•╵•╷•│ │•••│•│ ├───┘•│ │ ◎│ └─────┘ ``` -------------------------------- ### Combined flags example Source: https://context7.com/buko106/go-maze/llms.txt This example demonstrates combining multiple flags for maze generation, solution finding, analysis, and rendering. It generates a Wilson maze, computes its BFS solution, prints analysis, and renders it in Unicode. ```bash ./maze -a wilson --solution --analyze --format unicode --size 11 --seed 456 # Generates a Wilson maze, computes BFS solution, prints full analysis, # then renders in Unicode box-drawing with solution path overlaid. ``` -------------------------------- ### Example ASCII Maze Output Source: https://github.com/buko106/go-maze/blob/main/README.md Example of a 7x7 maze generated with DFS algorithm, seed 42, in ASCII format. ```bash ./maze -a dfs --seed 42 -s 7 ``` ```text ####### #●# # # # # # # # # ##### # # ○# ####### ``` -------------------------------- ### Example Unicode Maze Output Source: https://github.com/buko106/go-maze/blob/main/README.md Example of a 7x7 maze generated with DFS algorithm, seed 42, in Unicode box-drawing character format. ```bash ./maze -a dfs --seed 42 -s 7 -f unicode ``` ```text ┌─┬───┐ │◉│ │ │ ╵ ╷ │ │ │ │ ├───┘ │ │ ◎│ └─────┘ ``` -------------------------------- ### Example JSON Maze Output Source: https://github.com/buko106/go-maze/blob/main/README.md Example of a 7x7 maze generated with DFS algorithm, seed 42, in JSON format. This format is suitable for programmatic use. ```bash ./maze -a dfs --seed 42 -s 7 -f json ``` ```json { "width": 7, "height": 7, "grid": [ [true,true,true,true,true,true,true], [true,false,true,false,false,false,true], ... ], "start": {"Row": 1, "Col": 1}, "goal": {"Row": 5, "Col": 5}, "solution_path": [] } ``` -------------------------------- ### Example Larger DFS Maze Source: https://github.com/buko106/go-maze/blob/main/README.md Example of a larger 15x15 maze generated with DFS algorithm, seed 456. ```bash ./maze -a dfs --seed 456 -s 15 ``` ```text ############### #● # # ### # # ##### # # # # # # # ##### # # # # # # # # ######### ### # # # # # # # # ##### # # ``` -------------------------------- ### Example Kruskal Algorithm Maze Source: https://github.com/buko106/go-maze/blob/main/README.md Example of a 9x9 maze generated with Kruskal's algorithm using seed 123. ```bash ./maze -a kruskal --seed 123 -s 9 ``` ```text ######### #● # # ##### # # # # # ####### # # # # ### # # # #○# ######### ``` -------------------------------- ### Display BFS Solution Path Source: https://context7.com/buko106/go-maze/llms.txt Renders the maze with the shortest path from start to goal highlighted. The path is shown using '·' in ASCII, '•' in Unicode, or as a populated 'solution_path' array in JSON. ```bash ./maze -a dfs --seed 42 -s 7 --solution # Output (ASCII): # ####### # #●#···# # #·#·#·# # #···#·# # #####·# # # ○# # ####### ./maze -a dfs --seed 42 -s 7 -f unicode --solution # Output: # ┌─┬───┐ # │◉│•••│ # │•╵•╷•│ # │•••│•│ # ├───┘•│ # │ ◎│ # └─────┘ ./maze -f json --seed 42 -s 7 --solution # "solution_path": [ # {"Row":1,"Col":1}, {"Row":2,"Col":1}, ... # ] ``` -------------------------------- ### Example Kruskal Algorithm Maze with Solution Path Source: https://github.com/buko106/go-maze/blob/main/README.md Example of a 9x9 maze generated with Kruskal's algorithm, seed 123, with the solution path displayed. ```bash ./maze -a kruskal --seed 123 -s 9 --solution ``` ```text ######### #●····# # #####·# # # ···# # ##### # # ···# # #·###·# # #···#○# ######### ``` -------------------------------- ### Get Supported Maze Formats Source: https://context7.com/buko106/go-maze/llms.txt Call maze.GetSupportedFormats() to retrieve a list of all available maze output formats. ```go formats := maze.GetSupportedFormats() // ["ascii", "unicode", "json"] ``` -------------------------------- ### Get supported algorithms and difficulties in Go Source: https://context7.com/buko106/go-maze/llms.txt Retrieves lists of supported maze generation algorithms and difficulty levels. These functions are useful for validating user input or dynamically configuring maze generation. ```go algs := maze.GetSupportedAlgorithms() // ["dfs", "kruskal", "wilson", "hunt-kill", "growing-tree"] diffs := maze.GetSupportedDifficulties() // ["easy", "medium", "hard", "extreme"] ``` -------------------------------- ### BFS shortest path finding in Go Source: https://context7.com/buko106/go-maze/llms.txt Finds the shortest path from start to goal using Breadth-First Search (BFS). The resulting path can be attached to `m.SolutionPath` for rendering. Returns `nil` if no path exists. ```go g, _ := maze.NewGeneratorWithSeedAlgorithmAndDifficulty("42", "dfs", "medium") m := g.Generate(11, 11) path := maze.FindPath(m) if path != nil { m.SolutionPath = path fmt.Printf("Solution: %d steps\n", len(path)) // Solution: 15 steps } renderer, _ := maze.NewRenderer("ascii") fmt.Print(renderer.Render(m)) // solution path marked with '·' ``` -------------------------------- ### Generate Default Maze Source: https://github.com/buko106/go-maze/blob/main/README.md Generate a default 21x21 maze using the Depth-First Search algorithm. This is the simplest way to start generating mazes. ```bash ./maze ``` -------------------------------- ### JSON Maze Analysis Output Source: https://github.com/buko106/go-maze/blob/main/README.md Example of the JSON output for maze analysis, including grid dimensions, cell counts, and complexity metrics. ```json { "width": 9, "height": 9, "grid": [...], "start": {"Row": 1, "Col": 1}, "goal": {"Row": 7, "Col": 7}, "solution_path": [], "analysis": { "total_cells": 81, "path_cells": 31, "wall_cells": 50, "path_density": 0.38271604938271603, "dead_ends": 3, "junctions": 1, "corridors": 27, "dead_end_ratio": 0.0967741935483871, "junction_ratio": 0.03225806451612903, "solution_length": 17, "optimal_ratio": 0.5483870967741935, "difficulty_score": 53.47, "difficulty_level": "Medium" } } ``` -------------------------------- ### Build Application Binary with Make Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Compile the Go application into an executable binary named 'maze' in the current directory. ```bash make build ``` -------------------------------- ### Run Full Development Workflow with Make Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Execute the complete development process including cleaning, formatting, linting, testing, and building the application. ```bash make dev ``` -------------------------------- ### Show Help Information Source: https://github.com/buko106/go-maze/blob/main/README.md Display the help message for the go-maze command-line tool to see all available options and their descriptions. ```bash ./maze --help ``` -------------------------------- ### Manual Go Build and Test Commands Source: https://github.com/buko106/go-maze/blob/main/README.md Manually build the project binary and run Go tests, including coverage reporting and code formatting. ```bash # Build and install go build -o maze . # Run tests go test ./... # Run tests with coverage go test -cover ./... # Format code go fmt ./... ``` -------------------------------- ### Build Go Application Binary Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Compile the Go application directly, creating an executable file named 'maze' in the current directory. ```bash go build -o maze . ``` -------------------------------- ### Run All Tests with Make Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Execute all defined unit and integration tests for the project. ```bash make test ``` -------------------------------- ### Display All Makefile Targets with Make Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Show a list of all available commands and targets within the Makefile. ```bash make help ``` -------------------------------- ### Development Workflow with Make Source: https://github.com/buko106/go-maze/blob/main/README.md Execute common development tasks such as cleaning, formatting, linting, testing, and building using the Makefile. ```bash # Development workflow (clean, format, lint, test, build) make dev # Build the binary make build # Run tests make test # Run with verbose output make test-verbose # Generate coverage report make coverage # Format and lint code make fmt lint # Run examples make examples # Show all available targets make help ``` -------------------------------- ### Run All Pre-commit Hooks on All Files Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Execute all pre-commit hooks defined for the repository on every file in the project. ```bash pre-commit run --all-files ``` -------------------------------- ### Run Comprehensive Linting with GolangCI-Lint Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Execute a full suite of linters provided by golangci-lint to ensure high code quality. ```bash golangci-lint run ``` -------------------------------- ### Format Code with Go Fmt (Legacy) Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Apply code formatting using the standard 'go fmt' command. This is a legacy method. ```bash make fmt-go ``` -------------------------------- ### maze.GetSupportedAlgorithms() and maze.GetSupportedDifficulties() Source: https://context7.com/buko106/go-maze/llms.txt Retrieves lists of supported maze generation algorithms and difficulty levels. ```APIDOC ## maze.GetSupportedAlgorithms() and maze.GetSupportedDifficulties() ### Description These functions provide lists of all available maze generation algorithms and difficulty levels that can be used when creating a maze generator. ### Method Signatures `func GetSupportedAlgorithms() []string` `func GetSupportedDifficulties() []string` ### Usage Example ```go algs := maze.GetSupportedAlgorithms() // algs will be: ["dfs", "kruskal", "wilson", "hunt-kill", "growing-tree"] diffs := maze.GetSupportedDifficulties() // diffs will be: ["easy", "medium", "hard", "extreme"] ``` ``` -------------------------------- ### List Available Linters in GolangCI-Lint Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Display a list of all linters that are available for use with golangci-lint. ```bash golangci-lint linters ``` -------------------------------- ### Run Verbose Tests with Make Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Execute all tests with detailed output to observe test execution flow. ```bash make test-verbose ``` -------------------------------- ### Development Commands Source: https://context7.com/buko106/go-maze/llms.txt Standard make commands for development tasks including cleaning, formatting, linting, testing, and building the project. ```bash make dev # clean → fmt → lint → test → build ``` ```bash make test # go test ./... ``` ```bash make coverage # generate HTML coverage report (>95% target) ``` ```bash make examples # run example invocations from README ``` ```bash make lint # golangci-lint run ``` -------------------------------- ### Run Tests with Coverage Reporting using Make Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Execute all tests and generate a coverage report to assess code coverage. ```bash make test-coverage ``` -------------------------------- ### Run Maze Application with Growing Tree Algorithm Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Generate a maze using the Growing Tree algorithm with a specified size. ```bash ./maze --algorithm growing-tree --size 11 ``` -------------------------------- ### List Available Formatters in GolangCI-Lint Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Display a list of all formatters that can be used with golangci-lint. ```bash golangci-lint formatters ``` -------------------------------- ### Use Different Maze Generation Algorithms Source: https://github.com/buko106/go-maze/blob/main/README.md Select a maze generation algorithm using the -a or --algorithm flag. Available algorithms include dfs, kruskal, wilson, hunt-kill, and growing-tree. ```bash ./maze -a dfs --size 15 # Depth-First Search (default) ``` ```bash ./maze -a kruskal --size 15 # Kruskal's algorithm ``` ```bash ./maze -a wilson --size 15 # Wilson's algorithm ``` ```bash ./maze -a hunt-kill --size 15 # Hunt-Kill algorithm ``` ```bash ./maze -a growing-tree --size 15 # Growing Tree algorithm ``` -------------------------------- ### Run All Go Tests Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Execute all tests within the current Go project, including sub-packages. ```bash go test ./... ``` -------------------------------- ### Generate HTML Coverage Report with Make Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Generate an HTML visualization of the test coverage report. ```bash make coverage ``` -------------------------------- ### Run Maze Application with Hunt-Kill Algorithm Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Generate a maze using the Hunt-Kill algorithm with a specified size. ```bash ./maze --algorithm hunt-kill --size 11 ``` -------------------------------- ### Run Tests with Coverage Reporting Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Execute all tests in the project and generate a coverage report. ```bash go test -cover ./... ``` -------------------------------- ### Run Maze Application with Unicode Output Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Generate a maze and display it using Unicode box-drawing characters for a specified size. ```bash ./maze --format unicode --size 11 ``` -------------------------------- ### Run Maze Application with Growing Tree and Hard Difficulty Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Generate a maze using the Growing Tree algorithm with a specified size and 'hard' difficulty. ```bash ./maze --algorithm growing-tree --difficulty hard --size 11 ``` -------------------------------- ### Run Maze Application with Custom Size Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Generate a maze of a specified size using the default algorithm and settings. ```bash ./maze --size 15 ``` -------------------------------- ### Format Code with GolangCI-Lint Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Apply code formatting rules to the project using the golangci-lint tool. ```bash make fmt ``` -------------------------------- ### Display Maze Solution Path Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Generate a maze with a specified size and seed, then display the solution path. ```bash ./maze --solution --seed 42 --size 9 ``` -------------------------------- ### Analyze Maze with Hunt-Kill Algorithm Source: https://github.com/buko106/go-maze/blob/main/README.md Analyze a maze generated by the Hunt-Kill algorithm with a given seed and size, displaying a text-based report. ```bash ./maze -a hunt-kill --analyze --seed 42 -s 9 ``` -------------------------------- ### Generate Wilson Algorithm Maze with Solution Path Source: https://github.com/buko106/go-maze/blob/main/README.md Generate a maze using the Wilson algorithm and display the solution path. ```bash ./maze -a wilson --seed 456 -s 15 --solution ``` -------------------------------- ### Display Solution Path Source: https://github.com/buko106/go-maze/blob/main/README.md Show the solution path on the generated maze by using the --solution flag. This uses BFS pathfinding. ```bash ./maze --solution --size 11 --seed 123 ``` ```bash ./maze -a kruskal --solution --seed 42 --size 9 ``` ```bash ./maze -f unicode --solution --seed 42 --size 9 ``` -------------------------------- ### Run Maze Application with Wilson's Algorithm Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Generate a maze using Wilson's algorithm with a specified size. ```bash ./maze --algorithm wilson --size 11 ``` -------------------------------- ### Lint Code with Go Vet (Legacy) Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Perform basic code linting using the 'go vet' command. This is a legacy method. ```bash make lint-go ``` -------------------------------- ### maze.NewGrowingTreeWithDifficulty() Source: https://context7.com/buko106/go-maze/llms.txt Constructs a GrowingTreeAlgorithm with customizable selection strategy weights for fine-grained difficulty control. ```APIDOC ## `maze.NewGrowingTreeWithDifficulty()` — Direct algorithm construction ### Description Instantiates a `GrowingTreeAlgorithm` with explicit `SelectionStrategy` weights for custom difficulty tuning beyond the four presets. ### Usage ```go // Use a predefined difficulty preset alg := maze.NewGrowingTreeWithDifficulty(maze.DifficultyExtreme) // Example Strategy weights: // Strategy: NewestWeight=0.9, OldestWeight=0.05, RandomWeight=0.05 // Or construct a Generator manually via the Algorithm interface import "math/rand" rng := rand.New(rand.NewSource(42)) m := &maze.Maze{ Width: 11, Height: 11, Grid: /* initialized all-walls grid */, StartRow: 1, StartCol: 1, GoalRow: 9, GoalCol: 9, } alg.Generate(m, 1, 1, rng) ``` ``` -------------------------------- ### Generate and Analyze Maze in JSON Format Source: https://github.com/buko106/go-maze/blob/main/README.md Generate a maze using the Growing Tree algorithm with extreme difficulty, analyze it, and output the results in JSON format. ```bash ./maze -a growing-tree -d extreme --analyze --format json --seed 42 -s 9 ``` -------------------------------- ### Analyze Maze Properties Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Generate a maze with a specified size and seed, then display its analysis properties. ```bash ./maze --analyze --size 11 --seed 42 ``` -------------------------------- ### Use Different Output Formats Source: https://github.com/buko106/go-maze/blob/main/README.md Specify the output format using the -f or --format flag. Supported formats are ascii, unicode, and json. ```bash ./maze -f ascii --size 11 # ASCII format (default) ``` ```bash ./maze -f unicode --size 11 # Unicode box-drawing characters ``` ```bash ./maze -f json --size 11 # JSON format for programmatic use ``` -------------------------------- ### Full configuration generator in Go Source: https://context7.com/buko106/go-maze/llms.txt Creates a maze generator with explicit seed, algorithm, and difficulty. Handles errors for unsupported algorithm names. The generated maze dimensions and properties are noted. ```go g, err := maze.NewGeneratorWithSeedAlgorithmAndDifficulty("42", "growing-tree", "hard") if err != nil { log.Fatal(err) } m := g.Generate(11, 11) // m.Width, m.Height: 11 // m.Grid: [][]bool (true=wall, false=path) // m.StartRow, m.StartCol: 1, 1 // m.GoalRow, m.GoalCol: 9, 9 ``` -------------------------------- ### Construct GrowingTreeAlgorithm with Custom Difficulty Source: https://context7.com/buko106/go-maze/llms.txt Use maze.NewGrowingTreeWithDifficulty() to create a GrowingTreeAlgorithm with specific SelectionStrategy weights for custom difficulty tuning. Alternatively, manually construct a Generator via the Algorithm interface. ```go // Use a predefined difficulty preset alg := maze.NewGrowingTreeWithDifficulty(maze.DifficultyExtreme) // Strategy: NewestWeight=0.9, OldestWeight=0.05, RandomWeight=0.05 ``` ```go // Or construct a Generator manually via the Algorithm interface import "math/rand" rng := rand.New(rand.NewSource(42)) m := &maze.Maze{ Width: 11, Height: 11, Grid: /* initialized all-walls grid */, StartRow: 1, StartCol: 1, GoalRow: 9, GoalCol: 9, } alg.Generate(m, 1, 1, rng) ``` -------------------------------- ### Select Maze Generation Algorithm Source: https://context7.com/buko106/go-maze/llms.txt Generates a maze using a specific algorithm (dfs, kruskal, wilson, hunt-kill, growing-tree) with a given seed and size. ```bash ./maze -a dfs --seed 42 -s 7 # Output: # ####### # #●# # # # # # # # # # # # ##### # # # ○# # ####### ./maze -a kruskal --seed 123 -s 9 # Output: # ######### # #● # # # ##### # # # # # # # ####### # # # # # # ### # # # # #○# # ######### ./maze -a wilson --seed 456 -s 15 ./maze -a hunt-kill --seed 789 -s 11 ./maze -a growing-tree --seed 111 -s 11 ``` -------------------------------- ### Create Maze Renderers with maze.NewRenderer() Source: https://context7.com/buko106/go-maze/llms.txt Use maze.NewRenderer() to create renderers for different output formats like ASCII, Unicode, or JSON. The JSON renderer can optionally include embedded analysis data. ```go // ASCII renderer r, _ := maze.NewRenderer("ascii") fmt.Print(r.Render(m)) ``` ```go // Unicode box-drawing renderer r, _ = maze.NewRenderer("unicode") fmt.Print(r.Render(m)) ``` ```go // JSON renderer — basic r, _ = maze.NewRenderer("json") fmt.Print(r.Render(m)) ``` ```go // JSON renderer with embedded analysis jsonR := &maze.JSONRenderer{} fmt.Print(jsonR.RenderWithAnalysis(m, analysis)) ``` -------------------------------- ### Run Specific Package Tests with Verbose Output Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Execute tests for the 'maze' package with verbose output enabled. ```bash go test -v ./internal/maze ``` -------------------------------- ### Run Maze Application with JSON Output Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Generate a maze and output its structure in JSON format for a specified size. ```bash ./maze --format json --size 11 ``` -------------------------------- ### Display Maze Solution Path with Unicode Output Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Generate a maze with a specified size and seed, display the solution path, and use Unicode for output. ```bash ./maze -f unicode --solution --seed 42 --size 9 ``` -------------------------------- ### Run Maze Application with Seed and Custom Size Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Generate a reproducible maze of a specified size using a given seed value. ```bash ./maze --seed 123 --size 9 ``` -------------------------------- ### Run Maze Application with Kruskal's Algorithm Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Generate a maze using Kruskal's algorithm with a specified size. ```bash ./maze --algorithm kruskal --size 11 ``` -------------------------------- ### Apply Formatters and Fix Issues with GolangCI-Lint Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Use golangci-lint to automatically apply formatters and fix common code style issues. ```bash golangci-lint fmt ``` -------------------------------- ### Generate Growing Tree Algorithm Maze (Hard Difficulty) Source: https://github.com/buko106/go-maze/blob/main/README.md Generate a maze using the Growing Tree algorithm with hard difficulty, a specific seed, and size. ```bash ./maze -a growing-tree -d hard --seed 111 -s 11 ``` -------------------------------- ### Select Output Format Source: https://context7.com/buko106/go-maze/llms.txt Specifies the output format for the maze. Supported formats are ASCII, Unicode, and JSON. ```bash # ASCII (default): '#' walls, ' ' paths, '●' start, '○' goal ./maze -a dfs --seed 42 -s 7 -f ascii # Unicode: box-drawing characters, '◉' start, '◎' goal ./maze -a dfs --seed 42 -s 7 -f unicode # Output: # ┌─┬───┐ # │◉│ │ # │ ╵ ╷ │ # │ │ │ # ├───┘ │ # │ ◎│ # └─────┘ # JSON: structured data for programmatic use ./maze -a dfs --seed 42 -s 7 -f json # Output: # { # "width": 7, # "height": 7, # "grid": [ # [true,true,true,true,true,true,true], # [true,false,true,false,false,false,true], # ... # ], # "start": {"Row": 1, "Col": 1}, # "goal": {"Row": 5, "Col": 5}, # "solution_path": [] # } ``` -------------------------------- ### maze.NewAnalyzer().Analyze() Source: https://context7.com/buko106/go-maze/llms.txt Analyzes a maze to provide complexity metrics and a difficulty assessment. ```APIDOC ## maze.NewAnalyzer().Analyze() ### Description Creates a maze analyzer and uses it to compute various complexity metrics for a given maze, including counts of dead ends, junctions, corridors, path density, solution length, and an overall difficulty score and level. ### Method Signatures `func NewAnalyzer() *Analyzer` `func (a *Analyzer) Analyze(m *Maze) (*MazeAnalysis, error)` ### Parameters - **m** (*Maze) - A pointer to the maze object to be analyzed. ### Returns - `*MazeAnalysis` - A pointer to a `MazeAnalysis` struct containing detailed metrics. - `error` - An error if the analysis fails. ### MazeAnalysis Fields - **TotalCells** (int) - **PathCells** (int) - **WallCells** (int) - **PathDensity** (float64) - **DeadEnds** (int) - **Junctions** (int) - **Corridors** (int) - **DeadEndRatio** (float64) - **JunctionRatio** (float64) - **SolutionLength** (int) - **OptimalRatio** (float64) - **DifficultyScore** (float64) - **DifficultyLevel** (string) ### Usage Example ```go g, _ := maze.NewGeneratorWithSeedAlgorithmAndDifficulty("42", "hunt-kill", "medium") m := g.Generate(9, 9) analyzer := maze.NewAnalyzer() analysis, err := analyzer.Analyze(m) if err != nil { log.Fatal(err) } fmt.Println(analysis.String()) fmt.Printf("Dead ends: %d\n", analysis.DeadEnds) fmt.Printf("Score: %.1f\n", analysis.DifficultyScore) fmt.Printf("Level: %s\n", analysis.DifficultyLevel) ``` ``` -------------------------------- ### maze.NewGeneratorWithAlgorithmAndDifficulty() Source: https://context7.com/buko106/go-maze/llms.txt Creates a maze generator with a specified algorithm and difficulty, using a random seed. ```APIDOC ## maze.NewGeneratorWithAlgorithmAndDifficulty() ### Description Creates a maze generator using a specified algorithm and difficulty level, with a randomly generated seed. ### Method Signature `func NewGeneratorWithAlgorithmAndDifficulty(algorithm string, difficulty string) (*Generator, error)` ### Parameters - **algorithm** (string) - The name of the maze generation algorithm (e.g., "kruskal"). - **difficulty** (string) - The desired difficulty level (e.g., "medium"). ### Usage Example ```go g, err := maze.NewGeneratorWithAlgorithmAndDifficulty("kruskal", "medium") if err != nil { log.Fatal(err) } m := g.Generate(15, 15) ``` ``` -------------------------------- ### Display Maze Complexity Analysis Source: https://github.com/buko106/go-maze/blob/main/README.md Analyze maze complexity metrics by using the --analyze flag. This provides detailed complexity data. ```bash ./maze --analyze --size 11 --seed 123 ``` ```bash ./maze -a growing-tree -d hard --analyze --size 11 ``` ```bash ./maze --analyze --format json --size 11 # Analysis in JSON format ``` -------------------------------- ### Generate Wilson Algorithm Maze Source: https://github.com/buko106/go-maze/blob/main/README.md Generate a maze using the Wilson algorithm with the same seed for comparison. ```bash ./maze -a wilson --seed 456 -s 15 ``` -------------------------------- ### maze.FindPath() Source: https://context7.com/buko106/go-maze/llms.txt Calculates the shortest path through a maze using Breadth-First Search (BFS). ```APIDOC ## maze.FindPath() ### Description Calculates the shortest path from the start to the goal of a given maze using the Breadth-First Search (BFS) algorithm. The result can be optionally attached to the maze object to be displayed by renderers. ### Method Signature `func FindPath(m *Maze) []Position` ### Parameters - **m** (*Maze) - A pointer to the maze object for which to find the path. ### Returns - `[]Position` - A slice of `Position` structs representing the path from start to goal (inclusive). Returns `nil` if no path is found. ### Usage Example ```go g, _ := maze.NewGeneratorWithSeedAlgorithmAndDifficulty("42", "dfs", "medium") m := g.Generate(11, 11) path := maze.FindPath(m) if path != nil { m.SolutionPath = path fmt.Printf("Solution: %d steps\n", len(path)) } renderer, _ := maze.NewRenderer("ascii") fmt.Print(renderer.Render(m)) ``` ``` -------------------------------- ### Combine Features for Maze Generation Source: https://github.com/buko106/go-maze/blob/main/README.md Combine multiple features like algorithm selection, solution path display, analysis, and output format for advanced maze generation. ```bash ./maze -a hunt-kill --solution --analyze --seed 42 --size 11 ``` ```bash ./maze -a growing-tree -d extreme --analyze --format json --size 11 ``` ```bash ./maze -a wilson --solution --analyze --format unicode --size 11 ``` -------------------------------- ### Tidy Go Module Dependencies Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Clean up the go.mod file by removing unused dependencies and ensuring all required modules are present. ```bash go mod tidy ``` -------------------------------- ### Run Specific Pre-commit Hook Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Execute a single, specified pre-commit hook by its unique identifier. ```bash pre-commit run ``` -------------------------------- ### Generate Hunt-Kill Algorithm Maze Source: https://github.com/buko106/go-maze/blob/main/README.md Generate a maze using the Hunt-Kill algorithm with a specific seed and size. ```bash ./maze -a hunt-kill --seed 789 -s 11 ``` -------------------------------- ### maze.NewGeneratorWithSeedAndAlgorithm() Source: https://context7.com/buko106/go-maze/llms.txt Creates a maze generator with a specific seed and algorithm, without setting a difficulty level. ```APIDOC ## maze.NewGeneratorWithSeedAndAlgorithm() ### Description Creates a maze generator using a specific seed and algorithm, but without explicitly setting a difficulty level. The difficulty will be determined by default settings or algorithm behavior. ### Method Signature `func NewGeneratorWithSeedAndAlgorithm(seed string, algorithm string) (*Generator, error)` ### Parameters - **seed** (string) - The seed for maze generation to ensure reproducibility. - **algorithm** (string) - The name of the maze generation algorithm (e.g., "wilson"). ### Usage Example ```go g, err := maze.NewGeneratorWithSeedAndAlgorithm("999", "wilson") if err != nil { log.Fatal(err) } m := g.Generate(9, 9) ``` ``` -------------------------------- ### maze.NewRenderer() Source: https://context7.com/buko106/go-maze/llms.txt Factory function to create different maze renderers. Supports 'ascii', 'unicode', and 'json' formats. A custom JSONRenderer with analysis is also available. ```APIDOC ## `maze.NewRenderer()` — Output format factory ### Description Creates a maze renderer based on the provided format string. Supported formats include "ascii", "unicode", and "json". ### Usage ```go // ASCII renderer r, _ := maze.NewRenderer("ascii") fmt.Print(r.Render(m)) // Unicode box-drawing renderer r, _ = maze.NewRenderer("unicode") fmt.Print(r.Render(m)) // JSON renderer — basic r, _ = maze.NewRenderer("json") fmt.Print(r.Render(m)) ``` ### Custom JSON Renderer with Analysis ### Description Provides a JSON renderer that includes additional analysis data about the maze. ### Usage ```go jsonR := &maze.JSONRenderer{} fmt.Print(jsonR.RenderWithAnalysis(m, analysis)) // Example JSON output: // { // "width": 9, "height": 9, "grid": [...], // "start": {"Row":1,"Col":1}, // "goal": {"Row":7,"Col":7}, // "solution_path": [...], // "analysis": { "total_cells": 81, "difficulty_score": 45.8, ... } // } ``` ### `maze.GetSupportedFormats()` ### Description Returns a list of all supported maze output formats. ### Usage ```go formats := maze.GetSupportedFormats() // formats will be ["ascii", "unicode", "json"] ``` ``` -------------------------------- ### Random seed, named algorithm generator in Go Source: https://context7.com/buko106/go-maze/llms.txt Initializes a maze generator with a specified algorithm and difficulty, using a random seed. Returns an error if the algorithm name is not supported. ```go g, err := maze.NewGeneratorWithAlgorithmAndDifficulty("kruskal", "medium") if err != nil { log.Fatal(err) } m := g.Generate(15, 15) ``` -------------------------------- ### maze.NewGeneratorWithSeedAlgorithmAndDifficulty() Source: https://context7.com/buko106/go-maze/llms.txt Creates a maze generator with explicit control over seed, algorithm, and difficulty. ```APIDOC ## maze.NewGeneratorWithSeedAlgorithmAndDifficulty() ### Description Creates a generator with an explicit seed (for reproducibility), a named algorithm, and a difficulty level. Returns an error if the algorithm name is not supported. ### Method Signature `func NewGeneratorWithSeedAlgorithmAndDifficulty(seed string, algorithm string, difficulty string) (*Generator, error)` ### Parameters - **seed** (string) - The seed for maze generation. Ensures reproducible results. - **algorithm** (string) - The name of the maze generation algorithm to use (e.g., "growing-tree", "dfs"). - **difficulty** (string) - The desired difficulty level of the maze (e.g., "easy", "medium", "hard"). ### Usage Example ```go g, err := maze.NewGeneratorWithSeedAlgorithmAndDifficulty("42", "growing-tree", "hard") if err != nil { log.Fatal(err) } m := g.Generate(11, 11) // Maze properties like m.Width, m.Height, m.Grid, m.StartRow, m.StartCol, m.GoalRow, m.GoalCol are available on the generated maze. ``` ``` -------------------------------- ### Combined JSON output with analysis Source: https://context7.com/buko106/go-maze/llms.txt Use `--analyze` and `--format json` flags together to embed analysis data directly within the JSON output. This provides a comprehensive view of maze properties and metrics. ```bash ./maze -a growing-tree -d extreme --analyze --format json --seed 42 -s 9 # Output: # { # "width": 9, # "height": 9, # "grid": [...], # "start": {"Row": 1, "Col": 1}, # "goal": {"Row": 7, "Col": 7}, # "solution_path": [], # "analysis": { # "total_cells": 81, # "path_cells": 31, # "wall_cells": 50, # "path_density": 0.38271604938271603, # "dead_ends": 3, # "junctions": 1, # "corridors": 27, # "dead_end_ratio": 0.0967741935483871, # "junction_ratio": 0.03225806451612903, # "solution_length": 17, # "optimal_ratio": 0.5483870967741935, # "difficulty_score": 53.47, # "difficulty_level": "Medium" # } # } ``` -------------------------------- ### Run Specific Package Tests Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Execute tests only for the 'maze' package located in the 'internal/maze' directory. ```bash go test ./internal/maze ``` -------------------------------- ### Combined Maze Generation Features Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Generate a maze with specified algorithm, difficulty, analysis, JSON format, and size. ```bash ./maze -a growing-tree -d extreme --analyze --format json --size 11 ``` -------------------------------- ### Use Different Difficulty Levels for Growing Tree Source: https://github.com/buko106/go-maze/blob/main/README.md Adjust the difficulty level for the Growing Tree algorithm using the -d or --difficulty flag. Options are easy, medium, hard, and extreme. ```bash ./maze -a growing-tree -d easy --size 11 # Easy difficulty ``` ```bash ./maze -a growing-tree -d medium --size 11 # Medium difficulty (default) ``` ```bash ./maze -a growing-tree -d hard --size 11 # Hard difficulty ``` ```bash ./maze -a growing-tree -d extreme --size 11 # Extreme difficulty ``` -------------------------------- ### Maze complexity analysis in Go Source: https://context7.com/buko106/go-maze/llms.txt Analyzes a maze to provide complexity metrics including dead-end counts, junction counts, path density, solution length, and a difficulty score. The analysis results can be printed or accessed directly via fields. ```go g, _ := maze.NewGeneratorWithSeedAlgorithmAndDifficulty("42", "hunt-kill", "medium") m := g.Generate(9, 9) analyzer := maze.NewAnalyzer() analysis, err := analyzer.Analyze(m) if err != nil { log.Fatal(err) } fmt.Println(analysis.String()) // Maze Analysis Report: // Basic Metrics: // Total Cells: 81 // Path Cells: 31 (38.3%) // ... // Difficulty Assessment: // Difficulty Score: 45.8/100 // Difficulty Level: Medium // Access fields directly: fmt.Printf("Dead ends: %d\n", analysis.DeadEnds) fmt.Printf("Score: %.1f\n", analysis.DifficultyScore) fmt.Printf("Level: %s\n", analysis.DifficultyLevel) ``` -------------------------------- ### Generate Custom Size Maze Source: https://github.com/buko106/go-maze/blob/main/README.md Generate a maze with a custom size using the --size or -s flag. The size must be an odd number and at least 5. ```bash ./maze --size 15 ``` ```bash ./maze -s 9 ``` -------------------------------- ### maze.NewGenerator() Source: https://context7.com/buko106/go-maze/llms.txt Creates a new maze generator using the default settings: DFS algorithm and a random seed. ```APIDOC ## maze.NewGenerator() ### Description Creates a new maze generator with default settings (DFS algorithm, random seed). ### Method Signature `func NewGenerator() *Generator` ### Usage Example ```go package main import ( "fmt" "github.com/buko106/go-maze/internal/maze" ) func main() { g := maze.NewGenerator() m := g.Generate(21, 21) fmt.Print(m.String()) } ``` ``` -------------------------------- ### Clean Pre-commit Hook Environments Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Remove cached environments and temporary files created by pre-commit to free up disk space. ```bash pre-commit clean ``` -------------------------------- ### Default generator (DFS, random seed) in Go Source: https://context7.com/buko106/go-maze/llms.txt Initializes the default maze generator, which uses Depth-First Search (DFS) and a random seed. Generates a maze and prints its ASCII representation. ```go package main import ( "fmt" "github.com/buko106/go-maze/internal/maze" ) func main() { g := maze.NewGenerator() m := g.Generate(21, 21) fmt.Print(m.String()) // ASCII render via Maze.String() } ``` -------------------------------- ### Lint Code with GolangCI-Lint Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Perform code linting using golangci-lint to check for potential issues and enforce code quality standards. ```bash make lint ``` -------------------------------- ### Seeded + named algorithm generator in Go Source: https://context7.com/buko106/go-maze/llms.txt Creates a maze generator with a specific seed and algorithm, without specifying difficulty. Returns an error for unsupported algorithm names. ```go g, err := maze.NewGeneratorWithSeedAndAlgorithm("999", "wilson") if err != nil { log.Fatal(err) } m := g.Generate(9, 9) ``` -------------------------------- ### Generate Reproducible Maze with Seed Source: https://github.com/buko106/go-maze/blob/main/README.md Generate a maze with a specific seed for reproducible results. This ensures the same maze is generated every time with the same parameters. ```bash ./maze --seed 123 --size 11 ``` -------------------------------- ### Maze and Position Structs in Go Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Defines the core data structures for representing a maze, including its dimensions, grid, start/goal positions, and an optional solution path. The Position struct is a helper for coordinates. ```go type Maze struct { Width int Height int Grid [][]bool // true = wall, false = path StartRow int // Start position (●) StartCol int GoalRow int // Goal position (○) GoalCol int SolutionPath []Position // Optional solution path from start to goal (·) } type Position struct { Row int Col int } ``` -------------------------------- ### Set Growing Tree Difficulty Source: https://context7.com/buko106/go-maze/llms.txt Adjusts the difficulty for the Growing Tree algorithm, affecting path characteristics. Options are easy, medium, hard, and extreme. ```bash ./maze -a growing-tree -d easy --seed 111 -s 11 # More branching, easier ./maze -a growing-tree -d medium --seed 111 -s 11 # Balanced ./maze -a growing-tree -d hard --seed 111 -s 11 # Long winding paths ./maze -a growing-tree -d extreme --seed 111 -s 11 # Near-pure DFS, hardest # Output (hard): # ########### # #● # # # ###### ## # # # # # ###### # # # # # # # # # ## # # # # ## #### # # # # # # #### # ○# # ########### ``` -------------------------------- ### Maze Complexity Analysis Source: https://context7.com/buko106/go-maze/llms.txt Performs a detailed structural analysis of the maze, including cell counts, path density, solution length, and a difficulty score. This requires the '--analyze' flag. ```bash ./maze -a hunt-kill --analyze --seed 42 -s 9 # Output: # Maze Analysis Report: # # Basic Metrics: # Total Cells: 81 # Path Cells: 31 (38.3%) # Wall Cells: 50 (61.7%) # # Complexity Metrics: # Dead Ends: 2 (6.5% of paths) # Junctions: 0 (0.0% of paths) # Corridors: 29 (93.5% of paths) # # Solution Metrics: # Solution Length: 13 steps # Optimal Ratio: 41.9% (solution vs all paths) # # Difficulty Assessment: # Difficulty Score: 45.8/100 # Difficulty Level: Medium # # ######### # #● # # # ... ``` -------------------------------- ### Update Pre-commit Hook Versions Source: https://github.com/buko106/go-maze/blob/main/CLAUDE.md Automatically update the versions of all pre-commit hooks to their latest compatible releases. ```bash pre-commit autoupdate ``` -------------------------------- ### Generate Larger Kruskal Maze Source: https://github.com/buko106/go-maze/blob/main/README.md Use the Kruskal algorithm to generate a larger maze with a specified seed and size. ```bash ./maze -a kruskal --seed 456 -s 15 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.