-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from mkouhia/release_0.2
Release 0.2
- Loading branch information
Showing
8 changed files
with
561 additions
and
221 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,27 @@ | ||
[package] | ||
name = "wundernut-vol13" | ||
version = "0.1.2" | ||
version = "0.2.0" | ||
authors = ["Mikko Kouhia <[email protected]>"] | ||
edition = "2021" | ||
description = "Solution to Wundernut vol. 13" | ||
readme = "README.md" | ||
license = "MIT" | ||
repository = "https://github.com/mkouhia/wundernut-vol13" | ||
default-run = "solve-maze" | ||
|
||
[dependencies] | ||
anyhow = "1.0.86" | ||
clap = { version = "4.5.4", features = ["derive"] } | ||
itertools = "0.13.0" | ||
rand = { version = "0.8.5", optional = true } | ||
|
||
[features] | ||
mapgen = ["dep:rand"] | ||
|
||
[[bin]] | ||
name = "solve-maze" | ||
path = "src/main.rs" | ||
|
||
[[bin]] | ||
name = "generate-maze" | ||
required-features = ["mapgen"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//! CLI for maze solving | ||
use clap::Parser; | ||
use itertools::Itertools; | ||
use wundernut_vol13::maze_generator::MazeGenerator; | ||
|
||
/// Map generator for Wundernut vol. 13 | ||
#[derive(Parser, Debug)] | ||
#[command(version, about, long_about = None)] | ||
struct Args { | ||
/// Generated field height | ||
#[arg(long, default_value_t = 20)] | ||
height: usize, | ||
|
||
/// Generated field width | ||
#[arg(long, default_value_t = 15)] | ||
width: usize, | ||
|
||
/// Random seed | ||
#[arg(long)] | ||
seed: Option<u64>, | ||
} | ||
|
||
/// Read maze from file, print output | ||
fn main() -> anyhow::Result<()> { | ||
let args = Args::parse(); | ||
|
||
let mut gen = MazeGenerator::new(args.seed); | ||
let res: Vec<Vec<char>> = gen.generate_maze(args.height, args.width); | ||
println!("{}", res.iter().map(|row| row.iter().join("")).join("\n")); | ||
Ok(()) | ||
} |
Oops, something went wrong.