| ▲ | tromp 10 hours ago | |
A maze generator in the shape of a maze whose corridors spell a 4-letter word:
Generates a maze on the fly after entering the desired height of the maze. This compiled fine back in 1988 when I submitted it to the IOCCC (having rediscovered Eller's algorithm). Modern C compilers don't allow constant strings to be overwritten, which can be avoided by changing the first line to
The code is explained in detail at https://tromp.github.io/maze.html | ||
| ▲ | munificent 5 hours ago | parent | next [-] | |
Neat! Related: Here's a C program that draws random dungeons sort of like you use in a roguelike dungeon crawler: | ||
| ▲ | binaryturtle 9 hours ago | parent | prev | next [-] | |
If I squeeze the eyes I can read the "MAZE". :) Sadly neither version works here with an older clang on OS X. Both variants build fine with 9 warnings each. But the old variant dies with a "Bus Error: 10", and the new variant with "Segmentation fault: 11". Same with gcc (albeit only 8 warnings.) /edit OK, just wrong user input. You gotta feed it a number, and not a "foobar" or another random string. | ||
| ▲ | MaskRay 8 hours ago | parent | prev [-] | |
Amazing! I read you article in 2012 when the link was https://homepages.cwi.nl/~tromp/maze.html I was learning Haskell and Ocaml and wrote my own article in Chinese then https://maskray.me/blog/2012-11-02-perfect-maze-generation Now I should fix the link. | ||