Live data from Hacker News

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

gist.github.com

11–20 of 53 posts

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

#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

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

#13
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?

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

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

[deleted]

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

#15
post #9
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?

I'm not proficient at reading minimized code. Maybe you're better at it than I am. The ChatGPT output helps kickstart a meaningful discussion about the content of the code.

It would probably help if you included that context in the beginning of the comment. Not just dumping ChatGPT output.

From an outside observer it just seems like you wanted ChatGPT to contribute on your behalf, not start a discussion of the code.

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

#16
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?

probably fun

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

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

That looks like a variant of Truchet Tiles: https://en.wikipedia.org/wiki/Truchet_tiles

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

#18
post #15
post #9

Earlier quoted context omitted.

I'm not proficient at reading minimized code. Maybe you're better at it than I am. The ChatGPT output helps kickstart a meaningful discussion about the content of the code.

It would probably help if you included that context in the beginning of the comment. Not just dumping ChatGPT output. From an outside observer it just seems like you wanted ChatGPT to contribute on your behalf, not start a discussion of the code.

Fair enough. The Overton Window shifts quickly these days.

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

#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;
          }
        }
      }
    }
    if (d === 0) return;
  }

  for (let y = u - 1; y  t + w;
      const v = y  u + h;

      m[y][x] = s && v ? "!" : s ^ v ? "#" : ".";
    }
  }

  if (d > 0) m[f][e] = g(2) ? "'" : "+";

  for (let j = 0; j 
}

function main() { for (let y = 0; y

  for (let j = 0; j 
}

main();

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

#20
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
Post reply on HN