Live data from Hacker News

A random dungeon generator that fits on a business card (2019)

gist.github.com

41–50 of 53 posts

Re: A random dungeon generator that fits on a business card (2019)

#41
post #2

https://news.ycombinator.com/item?id=19309378 - A random dungeon generator in C, small enough to fit on a business card (2019) - 42 comments https://news.ycombinator.com/item?id=19290215 - original post referenced above - 23 comments

Thanks! Those two threads were just a couple days apart so I've belatedly merged them, yielding:

A random dungeon generator that fits on a business card - https://news.ycombinator.com/item?id=19290215 - March 2019 (64 comments)

Re: A random dungeon generator that fits on a business card (2019)

#42
post #12

I've always been a fan of generating mazes by randomly printing /, \, or a space. It ends up slanted, and there's obviously no guarantees of solvability, but it's surprisingly good for how simple it is. Here's a bash version in 50 characters ( https://codegolf.stackexchange.com/a/26011/7934 ): w=(╱ ╲);while :;do echo -n ${w[RANDOM%2]};done and how it looks like: https://i.stack.imgur.com/fRX05.png

> w=(╱ ╲);while :;do echo -n ${w[RANDOM%2]};done

Here is my orthogonal version:

`w=(├┤┴┬─\|);while :;do echo -n ${w:$RANDOM%6:1};done`

It is based on the 1-liner discussed at https://www.youtube.com/watch?v=oPtjcSsS2MI>, and uses the PETSCII characters within Unicode.

Screenshot: https://imgur.com/a/YrvpAqZ> (from `cool-retro-term`'s Apple II profile resized to 80x25, to sort of replicate a Commodore PET's look)

Re: A random dungeon generator that fits on a business card (2019)

#44
post #5

Earlier quoted context omitted.

In what way is what ChatGPT outputs when asked about this code relevant? There are more than 20 LLMs, do we expect to see a comment from each LLM about code submissions?

The code isn't very readable in the submitted form, so I appreciated the interpretation, whether or not it's ChatGPT or something else.

The interpretation is not correct, according to this comment: https://news.ycombinator.com/item?id=39422210

Re: A random dungeon generator that fits on a business card (2019)

#46
post #12

I've always been a fan of generating mazes by randomly printing /, \, or a space. It ends up slanted, and there's obviously no guarantees of solvability, but it's surprisingly good for how simple it is. Here's a bash version in 50 characters ( https://codegolf.stackexchange.com/a/26011/7934 ): w=(╱ ╲);while :;do echo -n ${w[RANDOM%2]};done and how it looks like: https://i.stack.imgur.com/fRX05.png

I don’t think there’s any spaces in that screenshot

Re: A random dungeon generator that fits on a business card (2019)

#47
post #12

I've always been a fan of generating mazes by randomly printing /, \, or a space. It ends up slanted, and there's obviously no guarantees of solvability, but it's surprisingly good for how simple it is. Here's a bash version in 50 characters ( https://codegolf.stackexchange.com/a/26011/7934 ): w=(╱ ╲);while :;do echo -n ${w[RANDOM%2]};done and how it looks like: https://i.stack.imgur.com/fRX05.png

Surprisingly good for what purpose?

Generating mazes

Re: A random dungeon generator that fits on a business card (2019)

#48

I saw this post about 2 hours ago, and I was fascinated by it and curious how it worked. So I decided to de-obfuscate it and add comments. The code was too large for a comment, so here's the gist: https://gist.github.com/paskozdilar/48d7532733ccd11144bb43fe... The approach is quite interesting - it (ab)uses the preprocessor to shorten the syntax of for loops: #define l(a, b, c, d) for (int y = a; y And then it does t…

> And then it does the heavy lifting by iterating over the whole map thousand times, randomly selecting a rectangle on the map and checking if the selected area is adjacent to an already-generated cave. It's a probabilistic algorithm, so there's a tiny chance that it will just print a single cave in the middle and nothing else.

Yeah, it's surprising how well this approach works. Performance is actually decent.

There is a chance of "dud" levels that only have a couple of rooms, but it's rare. The nice thing about this approach is that it guarantees by construction that every room in the dungeon will be reachable from every other one.

Post reply on HN