Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New maze generators #124

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ccc6fb6
Add: `CellMask`, `Generator` and a whole lot of stuff
ur-fault Oct 25, 2024
98c6765
Fix: small changes, optimizations, code style
ur-fault Oct 26, 2024
6279d3b
Add: splitting maze into regions, `generator` example
ur-fault Oct 26, 2024
060b34c
Add: `Generator::build_region_graph()`
ur-fault Oct 26, 2024
97fe06f
Fix: small changes
ur-fault Oct 26, 2024
687023a
Add: region to the borders of `build_region_graph()`
ur-fault Oct 26, 2024
3bf4265
Fix: small changes
ur-fault Oct 26, 2024
fe35291
Add: `connect_regions()`
ur-fault Oct 27, 2024
1d32cae
Fix: `build_region_graph` returns only borders now
ur-fault Oct 27, 2024
b3ecb61
Fix: `GroupGenerator::generate()` is deterministic now
ur-fault Oct 27, 2024
178f21f
Fix: typo in `randon_points()`
ur-fault Oct 27, 2024
85f8c42
Fix: clippy
ur-fault Oct 27, 2024
0a1103e
Add: use `Generator` in game
ur-fault Oct 27, 2024
50920c8
Add: migrate DFS to new generators
ur-fault Oct 28, 2024
4c02c3b
Add: progress tracking for generators
ur-fault Oct 28, 2024
513cae4
Fix: funky progressbar progress
ur-fault Oct 28, 2024
3b41382
Update: `Generator::*` takes mask instead of size
ur-fault Oct 28, 2024
a87860b
Fix: small mazes
ur-fault Oct 29, 2024
60fc5ea
Fix: faster points choice
ur-fault Oct 29, 2024
6cf74bc
Fix: remove old code
ur-fault Oct 29, 2024
488bde9
Remove: `ProgressHandler` in favor of tree-like `ProgressHandle`, Upd…
ur-fault Oct 29, 2024
583d65b
Add: terminate maze generation
ur-fault Oct 29, 2024
32b7241
Fix: small change
ur-fault Oct 29, 2024
d4c7a19
Update: rename `RegionGenerator`, Add: `RegionSplitter` trait
ur-fault Oct 29, 2024
f9c982b
Fix: use the new region splitters
ur-fault Oct 29, 2024
3dd5d44
Rename: `to_fn()` to `to_generator()`
ur-fault Oct 29, 2024
4934f51
Update: move `algorithms` to the root
ur-fault Oct 30, 2024
e0f950f
Update: move `RegionSplitter` to it's own module
ur-fault Oct 30, 2024
933aaef
Fix: small changes
ur-fault Oct 30, 2024
fa3195e
Fix: clippy: generator example
ur-fault Nov 4, 2024
8d08387
Add: `Registry<T>`, `MazeSpec`
ur-fault Nov 6, 2024
1d1eeac
Add: use new `MazeSpec` in tmaze itself
ur-fault Nov 6, 2024
aad3a48
Update: use whole maze spec in generator
ur-fault Dec 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix: typo in randon_points()
  • Loading branch information
ur-fault committed Oct 27, 2024
commit 178f21f29e660b8ad72daeabf55caca8d448ad4e
2 changes: 1 addition & 1 deletion cmaze/examples/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn main() {
let size = Dims3D(args[0] as i32, args[1] as i32, 1);
let point_count = args[2] as u8;

let points = Generator::randon_points(size, point_count, &mut rng);
let points = Generator::random_points(size, point_count, &mut rng);
let groups = Generator::split_groups(points, size, &mut rng);

let mut mask = Array3D::new_dims(false, size).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions cmaze/src/gameboard/algorithms/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ impl Generator {

const SPLIT_COUNT: i32 = 100;
let group_count = (size.product() / SPLIT_COUNT).min(u8::MAX as i32) as u8;
let points = Self::randon_points(size, group_count, &mut rng);
let points = Self::random_points(size, group_count, &mut rng);
let groups = Self::split_groups(points, size, &mut rng);
let masks = Self::split_to_masks(group_count, &groups);
let regions: Vec<_> = masks
Expand All @@ -225,7 +225,7 @@ impl Generator {
Ok(Self::connect_regions(groups, regions, &mut rng))
}

pub fn randon_points(size: Dims3D, count: u8, rng: &mut Random) -> Vec<Dims3D> {
pub fn random_points(size: Dims3D, count: u8, rng: &mut Random) -> Vec<Dims3D> {
assert!(size.all_positive());
assert!(count as i32 <= size.product());

Expand Down