Live data from Hacker News

Show HN: Random Roads

random-roads--edwardcunningh2.repl.co

21–30 of 52 posts

Re: Show HN: Random Roads

#23
post #14
post #5

Hey, good work! What algorithm did you use?

Thanks! You can see the code here: https://repl.it/@EdwardCunningh2/Random-Roads It's not especially clever: 1. I define a set of possible moves (eg. straight ahead, left turn, junction, etc). One possible move is a dead-end, which looks a bit like a house in my interpretation. 2. Each move is assigned a relative weight (eg. continuing straight ahead 10x more likely than turning left). 3. Each iteration, for each of…

Nice! My first page load I got a single line that stopped at the first point. Is that just able to happen?

Re: Show HN: Random Roads

#24
Really nice. I tried something like this many years ago in Flash, but the results this can produce are far more impressive!

Re: Show HN: Random Roads

#26
post #22

Reminds me of the Wave Function Collapse algorithm, although doesn't look to be that. https://github.com/mxgmn/WaveFunctionCollapse What algorithm is this using? Got a GitHub link?

It seems to be available in browser, see script.js it's not minified.

Re: Show HN: Random Roads

#28
post #23
post #14

Earlier quoted context omitted.

Thanks! You can see the code here: https://repl.it/@EdwardCunningh2/Random-Roads It's not especially clever: 1. I define a set of possible moves (eg. straight ahead, left turn, junction, etc). One possible move is a dead-end, which looks a bit like a house in my interpretation. 2. Each move is assigned a relative weight (eg. continuing straight ahead 10x more likely than turning left). 3. Each iteration, for each of…

Nice! My first page load I got a single line that stopped at the first point. Is that just able to happen?

Yes, there's nothing to prevent very small maps like what you saw - even ones that terminate with a dead-end before a road has been drawn (eg. https://random-roads--edwardcunningh2.repl.co/#1592758760947).

I considered adding logic to prevent this, but have decided to embrace it as a feature rather than a bug.

I quite like some of the small-ish maps, like this: https://random-roads--edwardcunningh2.repl.co/#1592759118928

Post reply on HN