Live data from Hacker News

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

gist.github.com

21–30 of 53 posts

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

#22
I'd love a random dungeon generator that includes multiple plateaus inside one room. For example, a dungeon with a waterfall or a tree.

Whenever I'd run an adventure, my players would often try me out, and open a door of some sorts. But the 2D maps feel very artificial. Guillaume Tavernier on Patreon makes maps with plateaus and multiple stories: https://www.patreon.com/dearchitecturart

A generator like that, would be awesome.

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

#24
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

This is the modern equivalent of the classic Commodore BASIC 10 PRINT CHR$(205.5+RND(1)); : GOTO 10

There's an entire book on this subject: https://10print.org

I can't recommend it without reservation, but if you're curious what a whole book about one line of code is like, you can find out.

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

#26
post #19

I heard you like javascript so here you go: const H = 40; const W = 80; let m = new Array(H).fill().map(() => new Array(W).fill(" ")); function g(x) { return Math.floor(Math.random() * x); } function cave(s) { const w = g(10) + 5; const h = g(6) + 3; let t = g(W - w - 2) + 1; let u = g(H - h - 2) + 1; for (let y = u - 1; y t + w; const v = y u + h; if (s ^ v && m[y][x] === "#") { d++; if (g(d) === 0) { e = x; f = y;…

Your business cards must be huge.

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

#27
post #4

[flagged]

I sort of understand the knee-jerk reactions to this. Hacker News is for humans, not robots, and there was an annoying trend of commenters posting LLM-generated summaries of articles, which deserve to get flagged off the page until they stop.

But I find it noteworthy, and in fact impressive, that ChatGPT can de-obfuscate and discern the meaning of this code. Letting the rest of us know that is a worthy contribution to the discussion.

I would suggest leading with a clear statement of why you're posting chatbot output, though. Folks around here have an allergy to that sort of thing for a reason.

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

#29
post #19

I heard you like javascript so here you go: const H = 40; const W = 80; let m = new Array(H).fill().map(() => new Array(W).fill(" ")); function g(x) { return Math.floor(Math.random() * x); } function cave(s) { const w = g(10) + 5; const h = g(6) + 3; let t = g(W - w - 2) + 1; let u = g(H - h - 2) + 1; for (let y = u - 1; y t + w; const v = y u + h; if (s ^ v && m[y][x] === "#") { d++; if (g(d) === 0) { e = x; f = y;…

I don't like this business card :( -- me, a JS dev far too often

(but also, thank you for sharing this!)

Post reply on HN