Browse code

Use an actually uniform distribution

Robert Cranston authored on 21/05/2025 21:58:13
Showing 1 changed files
... ...
@@ -10,7 +10,7 @@ Features:
10 10
     -   Hunt And Kill
11 11
         -   Handles mazes of any size
12 12
         -   Random with seed (time in seconds since the epoch by default)
13
-        -   Fairly fast (10000*10000 cells in ~900ms)
13
+        -   Fairly fast (10000*10000 cells in ~1200ms)
14 14
 
15 15
 [`cxx-maze`]: https://git.rcrnstn.net/rcrnstn/cxx-maze
16 16
 
... ...
@@ -19,7 +19,7 @@ Features:
19 19
 ```
20 20
 $ make
21 21
 $ ./maze dummy
22
-885ms
22
+1193ms
23 23
 $ ./maze
24 24
 ██  ████████████████████████████████████████████████████████████████████████████
25 25
 ██  ██                          ██              ██      ██          ██      ████
Browse code

Switch from C to C++ stdlib for randomness

Robert Cranston authored on 21/05/2025 21:54:38
Showing 1 changed files
... ...
@@ -10,7 +10,7 @@ Features:
10 10
     -   Hunt And Kill
11 11
         -   Handles mazes of any size
12 12
         -   Random with seed (time in seconds since the epoch by default)
13
-        -   Fairly fast (10000*10000 cells in ~1100ms)
13
+        -   Fairly fast (10000*10000 cells in ~900ms)
14 14
 
15 15
 [`cxx-maze`]: https://git.rcrnstn.net/rcrnstn/cxx-maze
16 16
 
... ...
@@ -19,7 +19,7 @@ Features:
19 19
 ```
20 20
 $ make
21 21
 $ ./maze dummy
22
-1154ms
22
+885ms
23 23
 $ ./maze
24 24
 ██  ████████████████████████████████████████████████████████████████████████████
25 25
 ██  ██                          ██              ██      ██          ██      ████
Browse code

Use a smaller representation for maze cells

Robert Cranston authored on 21/05/2025 20:25:47
Showing 1 changed files
... ...
@@ -10,7 +10,7 @@ Features:
10 10
     -   Hunt And Kill
11 11
         -   Handles mazes of any size
12 12
         -   Random with seed (time in seconds since the epoch by default)
13
-        -   Fairly fast (10000*10000 cells in ~1200ms)
13
+        -   Fairly fast (10000*10000 cells in ~1100ms)
14 14
 
15 15
 [`cxx-maze`]: https://git.rcrnstn.net/rcrnstn/cxx-maze
16 16
 
... ...
@@ -19,7 +19,7 @@ Features:
19 19
 ```
20 20
 $ make
21 21
 $ ./maze dummy
22
-1264ms
22
+1154ms
23 23
 $ ./maze
24 24
 ██  ████████████████████████████████████████████████████████████████████████████
25 25
 ██  ██                          ██              ██      ██          ██      ████
Browse code

Remember last restart position

Robert Cranston authored on 21/05/2025 15:15:40
Showing 1 changed files
... ...
@@ -10,7 +10,7 @@ Features:
10 10
     -   Hunt And Kill
11 11
         -   Handles mazes of any size
12 12
         -   Random with seed (time in seconds since the epoch by default)
13
-        -   Fairly slow (1000*1000 cells in ~4000ms)
13
+        -   Fairly fast (10000*10000 cells in ~1200ms)
14 14
 
15 15
 [`cxx-maze`]: https://git.rcrnstn.net/rcrnstn/cxx-maze
16 16
 
... ...
@@ -19,7 +19,7 @@ Features:
19 19
 ```
20 20
 $ make
21 21
 $ ./maze dummy
22
-3844ms
22
+1264ms
23 23
 $ ./maze
24 24
 ██  ████████████████████████████████████████████████████████████████████████████
25 25
 ██  ██                          ██              ██      ██          ██      ████
Browse code

Add benchmarking

Robert Cranston authored on 21/05/2025 15:09:29
Showing 1 changed files
... ...
@@ -10,7 +10,7 @@ Features:
10 10
     -   Hunt And Kill
11 11
         -   Handles mazes of any size
12 12
         -   Random with seed (time in seconds since the epoch by default)
13
-        -   Fairly naive
13
+        -   Fairly slow (1000*1000 cells in ~4000ms)
14 14
 
15 15
 [`cxx-maze`]: https://git.rcrnstn.net/rcrnstn/cxx-maze
16 16
 
... ...
@@ -18,6 +18,8 @@ Features:
18 18
 
19 19
 ```
20 20
 $ make
21
+$ ./maze dummy
22
+3844ms
21 23
 $ ./maze
22 24
 ██  ████████████████████████████████████████████████████████████████████████████
23 25
 ██  ██                          ██              ██      ██          ██      ████
Browse code

Buffer printing

Robert Cranston authored on 21/05/2025 01:54:54
Showing 1 changed files
... ...
@@ -4,7 +4,7 @@ A simple C++11 command line maze generator.
4 4
 
5 5
 Features:
6 6
 
7
--   Printing
7
+-   Printing (with buffering)
8 8
 -   Callback during generation
9 9
 -   Algorithms
10 10
     -   Hunt And Kill
Browse code

Add callback during generation

Robert Cranston authored on 21/05/2025 01:50:09
Showing 1 changed files
... ...
@@ -5,6 +5,7 @@ A simple C++11 command line maze generator.
5 5
 Features:
6 6
 
7 7
 -   Printing
8
+-   Callback during generation
8 9
 -   Algorithms
9 10
     -   Hunt And Kill
10 11
         -   Handles mazes of any size
Browse code

Seed with time in seconds since the epoch

Robert Cranston authored on 21/05/2025 01:04:11
Showing 1 changed files
... ...
@@ -8,7 +8,7 @@ Features:
8 8
 -   Algorithms
9 9
     -   Hunt And Kill
10 10
         -   Handles mazes of any size
11
-        -   Random with seed
11
+        -   Random with seed (time in seconds since the epoch by default)
12 12
         -   Fairly naive
13 13
 
14 14
 [`cxx-maze`]: https://git.rcrnstn.net/rcrnstn/cxx-maze
Browse code

Handle mazes of any size

Robert Cranston authored on 21/05/2025 01:01:36
Showing 1 changed files
... ...
@@ -7,7 +7,7 @@ Features:
7 7
 -   Printing
8 8
 -   Algorithms
9 9
     -   Hunt And Kill
10
-        -   Handles only odd-sized mazes
10
+        -   Handles mazes of any size
11 11
         -   Random with seed
12 12
         -   Fairly naive
13 13
 
... ...
@@ -18,29 +18,29 @@ Features:
18 18
 ```
19 19
 $ make
20 20
 $ ./maze
21
-██  ██████████████████████████████████████████████████████████████████████████
22
-██  ██                          ██              ██      ██          ██      ██
23
-██  ██  ██  ██████████████  ██████  ██  ██████  ██  ██  ██  ██  ██  ██  ██  ██
24
-██      ██  ██          ██  ██      ██      ██      ██      ██  ██  ██  ██  ██
25
-██  ██████  ██  ██  ██  ██████  ██████  ██  ██  ██████████████  ██  ██  ██  ██
26
-██      ██      ██  ██      ██      ██  ██  ██          ██      ██      ██  ██
27
-██  ██  ██████████  ██  ██  ██████  ██  ██  ██████████████  ██████████  ██  ██
28
-██  ██      ██      ██  ██      ██  ██  ██              ██  ██      ██  ██  ██
29
-██  ██████  ██  ██████████████  ██  ██  ██████████████  ██████  ██  ██████  ██
30
-██  ██      ██              ██      ██  ██              ██      ██          ██
31
-██████  ██  ██████████████  ██████████████  ██  ██  ██████  ██████████████████
32
-██      ██  ██      ██      ██              ██  ██  ██  ██                  ██
33
-██  ██████  ██  ██████  ██  ██  ██████████████  ██  ██  ██  ██  ██████████  ██
34
-██  ██      ██          ██  ██      ██          ██      ██  ██  ██      ██  ██
35
-██  ██  ██████████████  ██  ██████  ██████████████████  ██  ██  ██  ██████  ██
36
-██  ██  ██          ██  ██  ██      ██              ██  ██  ██  ██  ██      ██
37
-██  ██  ██  ██  ██  ██  ██  ██  ██████  ██  ██████  ██  ██  ██████  ██  ██████
38
-██  ██  ██  ██  ██  ██  ██  ██  ██      ██      ██  ██  ██      ██  ██      ██
39
-██  ██████  ██  ██  ██████  ██  ██  ██████████████  ██  ██████  ██  ██████  ██
40
-██  ██      ██  ██  ██      ██  ██  ██      ██      ██      ██  ██      ██  ██
41
-██  ██  ██████████  ██  ██████  ██  ██  ██  ██  ██████████  ██  ██████  ██  ██
42
-██      ██          ██      ██      ██  ██      ██          ██      ██      ██
43
-██████████████████████████████████████████████████████████████████████████  ██
21
+██  ████████████████████████████████████████████████████████████████████████████
22
+██  ██                          ██              ██      ██          ██      ████
23
+██  ██  ██  ██████████████  ██████  ██  ██████  ██  ██  ██  ██  ██  ██  ██  ████
24
+██      ██  ██          ██  ██      ██      ██      ██      ██  ██  ██  ██  ████
25
+██  ██████  ██  ██  ██  ██████  ██████  ██  ██  ██████████████  ██  ██  ██  ████
26
+██      ██      ██  ██      ██      ██  ██  ██          ██      ██      ██  ████
27
+██  ██  ██████████  ██  ██  ██████  ██  ██  ██████████████  ██████████  ██  ████
28
+██  ██      ██      ██  ██      ██  ██  ██              ██  ██      ██  ██  ████
29
+██  ██████  ██  ██████████████  ██  ██  ██████████████  ██████  ██  ██████  ████
30
+██  ██      ██              ██      ██  ██              ██      ██          ████
31
+██████  ██  ██████████████  ██████████████  ██  ██  ██████  ████████████████████
32
+██      ██  ██      ██      ██              ██  ██  ██  ██                  ████
33
+██  ██████  ██  ██████  ██  ██  ██████████████  ██  ██  ██  ██  ██████████  ████
34
+██  ██      ██          ██  ██      ██          ██      ██  ██  ██      ██  ████
35
+██  ██  ██████████████  ██  ██████  ██████████████████  ██  ██  ██  ██████  ████
36
+██  ██  ██          ██  ██  ██      ██              ██  ██  ██  ██  ██      ████
37
+██  ██  ██  ██  ██  ██  ██  ██  ██████  ██  ██████  ██  ██  ██████  ██  ████████
38
+██  ██  ██  ██  ██  ██  ██  ██  ██      ██      ██  ██  ██      ██  ██      ████
39
+██  ██████  ██  ██  ██████  ██  ██  ██████████████  ██  ██████  ██  ██████  ████
40
+██  ██      ██  ██  ██      ██  ██  ██      ██      ██      ██  ██      ██  ████
41
+██  ██  ██████████  ██  ██████  ██  ██  ██  ██  ██████████  ██  ██████  ██  ████
42
+██      ██          ██      ██      ██  ██      ██          ██      ██      ████
43
+██████████████████████████████████████████████████████████████████████████  ████
44 44
 ```
45 45
 
46 46
 <style>#example ~ pre { line-height: 1; }</style>
Browse code

Add implementation

Robert Cranston authored on 20/05/2025 23:55:27
Showing 1 changed files
... ...
@@ -2,8 +2,49 @@
2 2
 
3 3
 A simple C++11 command line maze generator.
4 4
 
5
+Features:
6
+
7
+-   Printing
8
+-   Algorithms
9
+    -   Hunt And Kill
10
+        -   Handles only odd-sized mazes
11
+        -   Random with seed
12
+        -   Fairly naive
13
+
5 14
 [`cxx-maze`]: https://git.rcrnstn.net/rcrnstn/cxx-maze
6 15
 
16
+## Example
17
+
18
+```
19
+$ make
20
+$ ./maze
21
+██  ██████████████████████████████████████████████████████████████████████████
22
+██  ██                          ██              ██      ██          ██      ██
23
+██  ██  ██  ██████████████  ██████  ██  ██████  ██  ██  ██  ██  ██  ██  ██  ██
24
+██      ██  ██          ██  ██      ██      ██      ██      ██  ██  ██  ██  ██
25
+██  ██████  ██  ██  ██  ██████  ██████  ██  ██  ██████████████  ██  ██  ██  ██
26
+██      ██      ██  ██      ██      ██  ██  ██          ██      ██      ██  ██
27
+██  ██  ██████████  ██  ██  ██████  ██  ██  ██████████████  ██████████  ██  ██
28
+██  ██      ██      ██  ██      ██  ██  ██              ██  ██      ██  ██  ██
29
+██  ██████  ██  ██████████████  ██  ██  ██████████████  ██████  ██  ██████  ██
30
+██  ██      ██              ██      ██  ██              ██      ██          ██
31
+██████  ██  ██████████████  ██████████████  ██  ██  ██████  ██████████████████
32
+██      ██  ██      ██      ██              ██  ██  ██  ██                  ██
33
+██  ██████  ██  ██████  ██  ██  ██████████████  ██  ██  ██  ██  ██████████  ██
34
+██  ██      ██          ██  ██      ██          ██      ██  ██  ██      ██  ██
35
+██  ██  ██████████████  ██  ██████  ██████████████████  ██  ██  ██  ██████  ██
36
+██  ██  ██          ██  ██  ██      ██              ██  ██  ██  ██  ██      ██
37
+██  ██  ██  ██  ██  ██  ██  ██  ██████  ██  ██████  ██  ██  ██████  ██  ██████
38
+██  ██  ██  ██  ██  ██  ██  ██  ██      ██      ██  ██  ██      ██  ██      ██
39
+██  ██████  ██  ██  ██████  ██  ██  ██████████████  ██  ██████  ██  ██████  ██
40
+██  ██      ██  ██  ██      ██  ██  ██      ██      ██      ██  ██      ██  ██
41
+██  ██  ██████████  ██  ██████  ██  ██  ██  ██  ██████████  ██  ██████  ██  ██
42
+██      ██          ██      ██      ██  ██      ██          ██      ██      ██
43
+██████████████████████████████████████████████████████████████████████████  ██
44
+```
45
+
46
+<style>#example ~ pre { line-height: 1; }</style>
47
+
7 48
 ## License
8 49
 
9 50
 Licensed under the [ISC License][] unless otherwise noted, see the
Browse code

Add license

Robert Cranston authored on 20/05/2025 22:44:43
Showing 1 changed files
... ...
@@ -3,3 +3,11 @@
3 3
 A simple C++11 command line maze generator.
4 4
 
5 5
 [`cxx-maze`]: https://git.rcrnstn.net/rcrnstn/cxx-maze
6
+
7
+## License
8
+
9
+Licensed under the [ISC License][] unless otherwise noted, see the
10
+[`LICENSE`][] file.
11
+
12
+[ISC License]: https://choosealicense.com/licenses/isc
13
+[`LICENSE`]: LICENSE
Browse code

Add readme

Robert Cranston authored on 20/05/2025 22:44:35
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,5 @@
1
+# [`cxx-maze`][]
2
+
3
+A simple C++11 command line maze generator.
4
+
5
+[`cxx-maze`]: https://git.rcrnstn.net/rcrnstn/cxx-maze