Live data from Hacker News

A single line of Basic sends readers into a labyrinth

slate.com

41–50 of 91 posts

Re: A single line of Basic sends readers into a labyrinth

#41
post #9

The article seems to be a a lot of hyperbole without much substance. The code itself is simple. CHR$(205.5 + RND(1)) becomes CHR$(205) or CHR$(206) depending on the random number. 205 generates a \ , and 206 generates a /.

10 PRINT MID$("/\",1.5+RND(1),1);:GOTO 10 Run it on another old-school computer, like an Apple II, and you won’t get the same transfixing result, for details that have to do with the Commodore 64’s character set, called PETSCII.

i think the key point is that / and \ do not span their character cells from corner to corner.

Re: A single line of Basic sends readers into a labyrinth

#42
post #27
post #10

A version that works in bash: yes 'c=(╱ ╲);printf ${c[RANDOM%2]}'|bash Source and credit: http://stackoverflow.com/a/13612327

Not for me. "syntax error near unexpected token ';' == no printf

Was it maybe trouble with '\' being treated as an escape character?

Re: A single line of Basic sends readers into a labyrinth

#43

Just to be clear...it doesn't generate a labyrinth. It generates something that looks like a labyrinth, but isn't one. It's just random forward and backward slashes.

This is an interesting long-running debate in procedural generation more generally. There are a lot of approaches, hybrids between them, and orthogonal decisions, but two ends of one axis of what I'd call "procedural faithfulness" are:

1. Attempt to faithfully simulate an underlying process. An example: procedurally generate canyons by simulating water flow and erosion. Dwarf Fortress tries to take this one to its logical conclusion, doing things like simulating thousands of years of history in order to decide where to place things.

2. Produce an algorithm that mimics a desired result without necessarily using a process even close to what produced the original. Often this involves attempting to capture patterns in the original without attempting to capture why those particular patterns arose. Many grammar-based methods take this approach, such as the classic "shape grammars" used in architecture, as do data-mining approaches.

This book looks at something closer to #2 from the perspective of procedural faithfulness. But it's a variant that was particularly popular in early algorithmic art: pick an algorithm that has interesting outputs, tweak it, and see what you can do with the results. So in a sense it's closer to #1 in that its macro-properties are emergent, rather than being specifically optimized for (it's not doing things like solving for path reachability).

If generating a city, for example, you could attempt any of these approaches. You could build a little artificial agent society where you simulate agents going to work, having families, buying houses, etc., and their actions produce a city. Or, you could play with hand-coded city-generation algorithms that produce interesting patterns, and go with one. Or, you could choose specific targets or constraints (maybe culled from databases of real city geometry) and use constraint-solving or genetic algorithms or generative machine-learning algorithms to produce the desired results. Different pros and cons.

It's something I've been thinking a bit about lately, because I've been trying to understand the landscape of systems that claim to do "automated game design" [1]. Much of the work takes a simulation-based approach: tries to come up with a theory of what makes a game "balanced" or "fun", and optionally also simulates a broader theory of game design, playtesting, and revision. But another approach is to view it as crafting generative spaces of game variants, which is more of a theory of how game structure can vary than a theory of why it varies, and gives a different (not clearly better or worse) angle on the problem.

[1] http://www.kmjn.org/notes/generating_mechanics_bibliography....

Re: A single line of Basic sends readers into a labyrinth

#45

Just to be clear...it doesn't generate a labyrinth. It generates something that looks like a labyrinth, but isn't one. It's just random forward and backward slashes.

Here's one with some contiguous areas highlighted, showing that it's made of interwoven islands: http://i.imgur.com/BX0ok.png?1

Re: A single line of Basic sends readers into a labyrinth

#47

Just to be clear...it doesn't generate a labyrinth. It generates something that looks like a labyrinth, but isn't one. It's just random forward and backward slashes.

The device you're on doesn't generate text. It looks like text, but it's really just red, green and blue dots.

> The device you're on doesn't generate text. It looks like text, but it's really just red, green and blue dots.

Printers don't generate text. It looks like text, but it's really just ink on paper.

The point is that real labyrinths have properties these pseudo-labyrinths don't. To be specific:

> In colloquial English, labyrinth is generally synonymous with maze, but many contemporary scholars observe a distinction between the two: maze refers to a complex branching (multicursal) puzzle with choices of path and direction; while a single-path (unicursal) labyrinth has only a single, non-branching path, which leads to the center. A labyrinth in this sense has an unambiguous route to the center and back and is not designed to be difficult to navigate.

http://en.wikipedia.org/wiki/Labyrinth

Re: A single line of Basic sends readers into a labyrinth

#48

Highly recommend picking up this book. As a former local colleague of Nick Montfort, I can say it's going to be a great read.

I recently read Racing the Beam (Monfort, Bogost), a survey of the defining technical details of the Atari 2600. I've read a number of gaming history books, and RtB was by far the most interesting. It might be better described as a hacker history of the platform, focusing on the limitations of the system and the hacks around them that caused Atari VCS games to have a personality distinct from its contemporaries. Also highly recommended.

[http://www.nickm.com/vcs/]

[http://www.platformstudies.com/]

Re: A single line of Basic sends readers into a labyrinth

#49
post #47

Earlier quoted context omitted.

The device you're on doesn't generate text. It looks like text, but it's really just red, green and blue dots.

> The device you're on doesn't generate text. It looks like text, but it's really just red, green and blue dots. Printers don't generate text. It looks like text, but it's really just ink on paper. The point is that real labyrinths have properties these pseudo-labyrinths don't. To be specific: > In colloquial English, labyrinth is generally synonymous with maze, but many contemporary scholars observe a distinction be…

"In colloquial English, labyrinth is generally synonymous with maze" means that yes, this is a labyrinth because "labyrinth" is synonymous with "maze". "Many contemporary scholars observe a distinction between the two" means "most people don't observe any distinction between the two."

Re: A single line of Basic sends readers into a labyrinth

#50
post #9

Earlier quoted context omitted.

10 PRINT MID$("/\",1.5+RND(1),1);:GOTO 10 Run it on another old-school computer, like an Apple II, and you won’t get the same transfixing result, for details that have to do with the Commodore 64’s character set, called PETSCII.

Is it the same as this C snippet? main() { while (1) printf("%c", rand()%2 ? '/' : '\\'); } Edit: Golfed my original snippet down, then put back original after mmphosis's identical translation.

Small variant:

void main() { while (1) printf("%c", "/\\"[rand()%2] ); }

Post reply on HN