Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

How Does a Single Line of BASIC Make an Intricate Maze?

timothy posted about 2 years ago | from the when-factors-align dept.

Books 438

JameskPratt writes "This Slate article talks about a single line of code — 10 PRINT CHR$ (205.5 + RND (1)); : GOTO 10 — and how it manages to create a complicated maze without the use of a loop, variables and without very complicated syntax." Now that amazing snippet of code is the basis of a book, and the book is freely downloadable.

Sorry! There are no comments related to the filter you selected.

Obfuscation (0)

Anonymous Coward | about 2 years ago | (#42155613)

It's time to start the Obfuscated BASIC contest...

http://www.ioccc.org/

Without the use of a loop!? (5, Insightful)

Anonymous Coward | about 2 years ago | (#42155619)

What is
10 something: GOTO 10
if not an (endless) loop?

Re:Without the use of a loop!? (4, Informative)

Nutria (679911) | about 2 years ago | (#42155647)

That's exactly what I thought... Maybe JameskPratt isn't a very good programmer.

Re: Without the use of a loop!? (4, Funny)

Anonymous Coward | about 2 years ago | (#42156061)

Pratt by name . . .

Re:Without the use of a loop!? (1)

dcollins (135727) | about 2 years ago | (#42155715)

[slick salesman voice] This is not your grandchild's looping mechanism! [/slick salesman voice]

Re:Without the use of a loop!? (2)

thestudio_bob (894258) | about 2 years ago | (#42155721)

print REPLY; goto PARENT;

Re:Without the use of a loop!? (5, Informative)

Anonymous Coward | about 2 years ago | (#42155737)

No shit, and it is not a labyrinth either. It is just randomly printing forward slashes and backlashes.

Re:Without the use of a loop!? (4, Insightful)

gl4ss (559668) | about 2 years ago | (#42155887)

No shit, and it is not a labyrinth either. It is just randomly printing forward slashes and backlashes.

"an intricate combination of paths or passages in which it is difficult to find one's way or to reach the exit."

it is that. it's just not very amazing at all if you describe it as printing \ and / randomly.

Re:Without the use of a loop!? (1)

Samantha Wright (1324923) | about 2 years ago | (#42156015)

it's just not very amazing at all if you describe it as printing \ and / randomly.

You are really going to break the author's heart if you keep that up.

It's hard to look at this story and not feel that it's a base case in an inductive proof that refutes the existence of art.

Re:Without the use of a loop!? (4, Interesting)

erroneus (253617) | about 2 years ago | (#42156093)

I think there is a bit of a story in the fact that while in function, it is extremely simple though in result/appearance it creates what most perceive to be a complex maze of passages. The code puts out random positive space objects while the mind sees a single, complex negative space.

It sort of reminds me of similar little tricks used to generate landscapes and other such things... mandelbrot comes to mind.

Re:Without the use of a loop!? (1)

tofubeer (1746800) | about 2 years ago | (#42156147)

To be a maze it would need an exit and and an entrance that are connected to one another.

Re:Without the use of a loop!? (1)

K. S. Kyosuke (729550) | about 2 years ago | (#42155863)

What is 10 something: GOTO 10 if not an (endless) loop?

Well, in certain dialects of Forth, you'd probably be able to write it using tail recursion. And it would be probably slightly shorter. :-)

Re:Without the use of a loop!? (3, Insightful)

Potor (658520) | about 2 years ago | (#42155899)

this is one of the stupidest /. stories ever -- it is not one line of code, and it is a loop, as you and many others point out.

Re:Without the use of a loop!? (4, Insightful)

shitzu (931108) | about 2 years ago | (#42155977)

And most importantly - its not a particularly amazing piece of code. I am not a programmer, but know how to write basic stuff in a few languages - and i do not find a TWO LINE LOOP that fills the screen with a choice between two characters that make up something that LOOKS LIKE A MAZE, but is not necessarily navigable not a least bit amazing.

Re:Without the use of a loop!? (3, Informative)

Zero__Kelvin (151819) | about 2 years ago | (#42156027)

" it is not one line of code"

Actualy, it absolutely is just one line of code. You are confusing the number of statements with the number of lines. In BASIC, as in many languages, you can have multiple statements and operation in a single line of code. Those statements do indeed however constitute an infinite loop, however.

Re:Without the use of a loop!? (0)

Anonymous Coward | about 2 years ago | (#42155985)

Re:Without the use of a loop!? (0)

Anonymous Coward | about 2 years ago | (#42156035)

I think ./ might have just nuked the fridge.

Re:Without the use of a loop!? (2)

Endophage (1685212) | about 2 years ago | (#42156037)

Submitter was a moron. From the book: "For a one-line program that loops forever..." also "...it uses GOTO 10 to loop back..."

Re:Without the use of a loop!? (0)

Samantha Wright (1324923) | about 2 years ago | (#42156079)

I'm sorry, the submitter can't hear you over how AMAZING this code snippet is. Buy a t-shirt!

Sad day for slashdot... (5, Insightful)

Anonymous Coward | about 2 years ago | (#42155623)

...when the summary does not know what a loop is.

Re:Sad day for slashdot... (0)

Anonymous Coward | about 2 years ago | (#42155861)

Fuck you I know what a loop [google.com] is!

Re:Sad day for slashdot... (5, Funny)

Zero__Kelvin (151819) | about 2 years ago | (#42156031)

Worse yet is the fact that the editors don't either.

Re:Sad day for slashdot... (4, Interesting)

Trepidity (597) | about 2 years ago | (#42156049)

Also, it can't string together a single grammatically correct sentence. Complete failure on both technical and English levels!

The book is, however, quite interesting (just go straight to the open-access PDF and skip the mediocre Slate article).

No loop? (5, Insightful)

chthon (580889) | about 2 years ago | (#42155625)

No editors with programming experience perhaps.

The basic definition of a loop is a GOTO to a previous address! All the rest is syntax and optimisation.

Re:No loop? (1, Insightful)

Anonymous Coward | about 2 years ago | (#42155735)

and it's not even a single line.

Everyone knows that : in BASIC starts a new line.

This is two lines.

Or are you going to suggest that simply s#\r\n## makes all programs a single line?

Re:No loop? (1)

AdamHaun (43173) | about 2 years ago | (#42155893)

and it's not even a single line.

Would it count anyway? Including a library function that implements a PRNG algorithm hardly sounds like "a single line of BASIC"...

(Not criticizing the book, which I've never read -- it may be a great book for all I know.)

Re:No loop? (1)

Zero__Kelvin (151819) | about 2 years ago | (#42156101)

"Would it count anyway? Including a library function that implements a PRNG algorithm hardly sounds like "a single line of BASIC""

Yes, it would, if only because RND is an official ANSII BASIC statement, not an external library. Common people, all this stuff is pretty basic .... ;-)

Re:No loop? (5, Informative)

Zero__Kelvin (151819) | about 2 years ago | (#42156069)

"Everyone knows that : in BASIC starts a new line."

Nobody knows that, because it is untrue. The : is a statement separator, not a line seperator. That 10 you see is the line number. Notice that there are no other line numbers. Make an error on either side of the colon and the interpreter will give you the exact same complaint: Syntax error in line 10. You can verify this by looking for the line " In BASIC it's used as a separator between the statements or instructions in a single line." on Wikipedia [wikipedia.org] , or use your Google-Fu to verify it thousands of other ways.

Re:No loop? (1)

Samantha Wright (1324923) | about 2 years ago | (#42156117)

: behaves differently from a true linebreak. An IF statement will skip over additional statements separated by colons if it fails:

10 INPUT "PLEASE INPUT Y OR N: ", A$
20 IF A$ "Y" AND A$ "N" THEN PRINT "INCORRECT": GOTO 10

The "GOTO 10" will only be executed if the condition is met. This is what early BASIC programmers had instead of if statements that supported blocks.

Re:No loop? (1)

BoRegardless (721219) | about 2 years ago | (#42156047)

Just missing BASIC experience...like I had in the 70s.

10 ... : GOTO 10 is a loop (5, Informative)

Mneme (56118) | about 2 years ago | (#42155627)

it manages to create a complicated maze with out the use of a loop, variables and without very complicate syntax

It's very cool the way this code draws a maze, but there's obviously a loop there.

(And it's “without” not “with out”, and “complicated” not “complicate”.)

Re: 10 ... : GOTO 10 is a loop (4, Interesting)

Lobachevsky (465666) | about 2 years ago | (#42155799)

it's not a maze, it's a pattern of random forward and backward slashes, "/" and "\". There's no guarantee that a path exists anywhere near the top to anywhere near the bottom. In fact, because it's random, you'd be blocked off at some point.

Re: 10 ... : GOTO 10 is a loop (1)

Frans Faase (648933) | about 2 years ago | (#42155995)

There are some interesting mathematical problems. Like given a certain width and an endless number of rows, if you start in at an arbitrary 'square', what is the distribution of the number of other squares that you can reach? (with or without wrapping?) What if it is endless in two directions?

It's 2012 (0)

Anonymous Coward | about 2 years ago | (#42155635)

There is a thing called recursion. It's the shit.

Re:It's 2012 (0)

Anonymous Coward | about 2 years ago | (#42156057)

There is a thing called recursion. It's the shit.

Its 2012 and infinite recursion still crashes. It just takes a little longer. At least an infinite loop does not crash.

Plus recursion is nothing new and it has a high cost performance-wise. This has been understood by some for many decades.

Its kiddies like you that explain why simple utilities need multiple GHz CPUs and multiple GBs of RAM. :-)

Re:It's 2012 (1)

allo (1728082) | about 2 years ago | (#42156131)

this "goto recursion" does not crash, because there is no stack to be able to jump back.

Without the use of a loop? (3, Informative)

Anonymous Coward | about 2 years ago | (#42155639)

That....is.....a loop.......

Yes Captain (2, Funny)

Anonymous Coward | about 2 years ago | (#42155907)

that's what our sensors are picking up.

Obfuscation (-1, Redundant)

Anonymous Coward | about 2 years ago | (#42155643)

The time is right to start the Obfuscated BASIC contest...

http://www.ioccc.org/

Some minor deficiencies (5, Insightful)

zmooc (33175) | about 2 years ago | (#42155651)

create a complicated maze with out the use of a loop
1. This is not necessarily a maze. It's noise. At best.
2. It's "without", not "with out"
3. There is a loop

Re:Some minor deficiencies (1, Informative)

daremonai (859175) | about 2 years ago | (#42155719)

The Slate article does make clear that this only works on something with the old Commodore 64 character set (PETSCII). And that it is a loop.It's not exactly a great article, but it does get these things right.

Re:Some minor deficiencies (1)

Cyberax (705495) | about 2 years ago | (#42155875)

It would work with any script that has '/' and '\' symbols separated by 1 code point.

Re:Some minor deficiencies (1)

larry bagina (561269) | about 2 years ago | (#42156109)

or can index into a string of "/\".

Re:Some minor deficiencies (1)

gl4ss (559668) | about 2 years ago | (#42155987)

The Slate article does make clear that this only works on something with the old Commodore 64 character set (PETSCII). And that it is a loop.It's not exactly a great article, but it does get these things right.

it would work on anything with the right type of font. if you want to try it on windows cmdline them from prefs select raster fonts and 8x8 pixel font.

(yeah I tested.. with a javascript script of all things, ugh)

Re:Some minor deficiencies (1)

reboot246 (623534) | about 2 years ago | (#42156021)

And it's not even news. We were doing this 30+ years ago!

Goto Makes a Loop (2)

dcollins (135727) | about 2 years ago | (#42155675)

Re: "it manages to create a complicated maze with out the use of a loop"

No loop? (0)

Anonymous Coward | about 2 years ago | (#42155681)

10 [somethong]; GOTO 10
is a loop!

Not impressed (0)

Anonymous Coward | about 2 years ago | (#42155687)

Color me unimpressed. It's just randomly printing forward and backward slashes, which line up because of the font. It's nifty, but hardly amazing.

Reminded me of DataGlyphs (4, Informative)

tepples (727027) | about 2 years ago | (#42155801)

It's just randomly printing forward and backward slashes, which line up because of the font. It's nifty, but hardly amazing.

And in fact, it appears Slashdot ran an article on this a decade ago when it was called DataGlyphs [slashdot.org] .

Enterprise Java Version (5, Funny)

Mr. Sketch (111112) | about 2 years ago | (#42155691)

package enterprise;

import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.Collections;
import java.util.Map.Entry;
import java.util.Random;
import java.util.SortedMap;
import java.util.TreeMap;

public class Maze {
    private final WallFactory<Double> wallFactory;
    private final EntropyGenerator entropyGenerator;

    public Maze( WallFactory<Double> wallFactory, EntropyGenerator entropyGenerator ) {
        this.wallFactory = wallFactory;
        this.entropyGenerator = entropyGenerator;
    }

    public void visit( MazeVisitor visitor ) throws MazeException {
        while( true ) {
            MazeWall wall = wallFactory.createMazeWall( entropyGenerator.getNewEntropyValue() );
            wall.visit( visitor );
        }
    }

    public interface MazeWall {
        /**
         * @param visitor
         * @throws IOException
         */
        void visit( MazeVisitor visitor ) throws MazeException;
    }

    public static class LeftDiagonalWall implements MazeWall {
        @Override
        public void visit( MazeVisitor visitor ) throws MazeException {
            visitor.visit( this );
        }
    }

    public static class RightDiagonalWall implements MazeWall {
        @Override
        public void visit( MazeVisitor visitor ) throws MazeException {
            visitor.visit( this );
        }
    }

    public interface MazeVisitor {
        void visit( LeftDiagonalWall leftDiagonalWall ) throws MazeException;

        void visit( RightDiagonalWall rightDiagonalWall ) throws MazeException;
    }

    public interface WallFactory<T> {
        /**
         * @param value
         * @return the MazeWall
         * @throws MazeException
         */
        MazeWall createMazeWall( T value ) throws MazeException;
    }

    public static class StrategyWallFactory<T> implements WallFactory<T> {
        private WallRepartitionStrategy<T> wallRepartitionStrategy;

        public StrategyWallFactory( WallRepartitionStrategy<T> wallRepartitionStrategy ) {
            this.wallRepartitionStrategy = wallRepartitionStrategy;
        }

        @Override
        public MazeWall createMazeWall( T value ) throws MazeException {
            Class<? extends MazeWall> wallClassForValue = wallRepartitionStrategy.getWallClassForValue( value );
            try {
                return wallClassForValue.newInstance();
            } catch( InstantiationException | IllegalAccessException e ) {
                throw new MazeException( "Cannot create MazeWall instance", e );
            }
        }
    }

    public interface WallRepartitionStrategy<T> {
        /**
         * @param value
         * @return the wall class for value
         * @throws MazeException
         */
        Class<? extends MazeWall> getWallClassForValue( T value ) throws MazeException;
    }

    public static class ProbabilityThresholdWallRepartitionStrategy implements WallRepartitionStrategy<Double> {
        private SortedMap<Double, Class<? extends MazeWall>> thresholds = new TreeMap<Double, Class<? extends MazeWall>>( Collections.reverseOrder() );

        public void declareWallThreshold( Double probability, Class<? extends MazeWall> wallClass ) throws MazeException {
            if( probability < 0 || probability > 1 ) {
                throw new MazeException( "Invalid probability " + probability );
            }
            thresholds.put( probability, wallClass );
        }

        @Override
        public Class<? extends MazeWall> getWallClassForValue( Double value ) throws MazeException {
            for( Entry<Double, Class<? extends MazeWall>> entry : thresholds.entrySet() ) {
                if( entry.getKey() < value ) {
                    return entry.getValue();
                }
            }
            throw new MazeException( "No MazeWall class found for probabitity threshold " + value );
        }
    }

    public static class MazePrintVisitor implements MazeVisitor {
        private static final String LEFT_WALL_REPRESENTATION = "&#9585;";
        private static final String RIGHT_WALL_REPRESENTATION = "&#9586;";

        private final Writer writer;
        private final int lineWidth;
        private int count;

        public MazePrintVisitor( Writer writer, int lineWidth ) {
            this.writer = writer;
            this.lineWidth = lineWidth;
        }

        @Override
        public void visit( LeftDiagonalWall leftDiagonalWall ) throws MazeException {
            print( LEFT_WALL_REPRESENTATION );
        }

        @Override
        public void visit( RightDiagonalWall rightDiagonalWall ) throws MazeException {
            print( RIGHT_WALL_REPRESENTATION );
        }

        private void print( String str ) throws MazeException {
            try {
                if( count >= lineWidth ) {
                    count = 0;
                    writer.write( System.lineSeparator() );
                }
                writer.write( str );
                count += str.codePointCount( 0, str.length() );
            } catch( IOException e ) {
                throw new MazeException( "Error printing maze", e );
            }
        }
    }

    public interface EntropyGenerator {
        double getNewEntropyValue();
    }

    public static class JavaRandomEntropyGenerator implements EntropyGenerator {
        private Random random = new Random();

        @Override
        public double getNewEntropyValue() {
            return random.nextDouble();
        }
    }

    public static class MazeException extends Exception {
        public MazeException( String message ) {
            super( message );
        }

        public MazeException( String message, Throwable cause ) {
            super( message, cause );
        }
    }

    public static void main( String[] args ) throws Exception {
        ProbabilityThresholdWallRepartitionStrategy repartitionStrategy = new ProbabilityThresholdWallRepartitionStrategy();
        repartitionStrategy.declareWallThreshold( 0.0, LeftDiagonalWall.class );
        repartitionStrategy.declareWallThreshold( 0.5, RightDiagonalWall.class );
        WallFactory<Double> wallFactory = new StrategyWallFactory<Double>( repartitionStrategy );

        EntropyGenerator entropyGenerator = new JavaRandomEntropyGenerator();

        Maze maze = new Maze( wallFactory, entropyGenerator );

        MazePrintVisitor printVisitor = new MazePrintVisitor( new OutputStreamWriter( System.out ), 40 );
        maze.visit( printVisitor );
    }

}

Python version (5, Interesting)

tepples (727027) | about 2 years ago | (#42155773)

The Python version is two non-comment lines:

#!/usr/bin/env python
# DataGlyphs simulator by Damian Yerrick
from random import choice
while True: print "".join(choice('/\\') for i in range(40))

Re:Python version (1)

Anonymous Coward | about 2 years ago | (#42156119)

Full width:


from random import choice
while True: print choice('/\\'),

Re:Enterprise Java Version (1)

CaptainLard (1902452) | about 2 years ago | (#42155791)

Thats nothing. Try parsing some serial bytes coming from a microcontroller.

Re:Enterprise Java Version (1)

roninmagus (721889) | about 2 years ago | (#42155793)

I love this. Especially the constants for left_wall_representation and right_wall_representation. If this were dot net and the kind of stuff I have to work in often, it would have to pull the random values from a WCF service.

Re:Enterprise Java Version (0)

Anonymous Coward | about 2 years ago | (#42155923)

This is one of the most painful / funny things I have ever read. Painful, because it hits too close home, funny because it is true.

Enterprise Java -- never again, *sigh*.

Re:Enterprise Java Version (0)

Anonymous Coward | about 2 years ago | (#42155941)

org.shittyexamples.maze.MazeFactory.printMaze();

Re:Enterprise Java Version (1)

AJWM (19027) | about 2 years ago | (#42156107)

Come now, that's hardly Enterprise Java without a few JDBC connections. ;)

Re:Enterprise Java Version (0)

Anonymous Coward | about 2 years ago | (#42156123)

At least the Enterprise Java version doesn't rot your brain!

Re:Enterprise Java Version (2)

CockMonster (886033) | about 2 years ago | (#42156145)

InstantiationException.IllegalAccessException cannot be resolved to a type Maze.java /Maze/src line 76 Java Problem Syntax error on token "|", . expected Maze.java /Maze/src line 76 Java Problem The method lineSeparator() is undefined for the type System Maze.java /Maze/src line 139 Java Problem

Loops (0)

Anonymous Coward | about 2 years ago | (#42155695)

It may not be a while(1) { ... }, but that GOTO at the end makes things functionally equivalent...

Re:Loops (0)

Anonymous Coward | about 2 years ago | (#42155915)

Please use for(;;) instead of while(1).

Without looping? (2)

sidragon.net (1238654) | about 2 years ago | (#42155705)

How does this not use a loop?

Perl analogue (5, Interesting)

Okian Warrior (537106) | about 2 years ago | (#42155725)

Don't have a Commodore Basic interpreter? this Perl 1-liner will do the same thing:

print ["/","\\"]->[rand(2)] while 1;

It has no start or end point, and for two arbitrary points you can't guarantee that a path exists.

...but it definitely *looks* like a maze, so that's what it must be. The authors said so, after all...

Re:Perl analogue (1)

Camel Pilot (78781) | about 2 years ago | (#42155797)

You beat me to it. Even sweeter.

Re:Perl analogue (0)

Anonymous Coward | about 2 years ago | (#42155835)

From TFA:

(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â(TM)s character set, called PETSCII.)

Or, if you run it on a modern computer (utf) and use U+2571 and U+2572, for a "more authentic" (45 degree angles) reproduction.

Re:Perl analogue (1)

gblfxt (931709) | about 2 years ago | (#42155981)

how does this guarantee its an ascii character though?

Re:Perl analogue (0)

Anonymous Coward | about 2 years ago | (#42156063)

Why waste characters when you can use:

print qw<\ />[rand 2]while 1

A book? (1)

roninmagus (721889) | about 2 years ago | (#42155727)

There's a book about this? It looks like it just randomly prints either a forward slash or a backslash. The fact it appears to be a maze is just an artifact of the monospaced type. Am I missing something here?

Re:A maze (1)

TaoPhoenix (980487) | about 2 years ago | (#42155805)

But what exactly is a maze? If you knowingly pick a valid start and end point, doesn't it become one? Isn't a maze basically a bunch of twisty lines designed to obfuscate the path from start to finish?

Re:A maze (0)

Anonymous Coward | about 2 years ago | (#42155959)

It would be a maze with that additional input. Without it, it's just a bunch of squiggly lines. (Hint: choosing those points is nontrivial)

Re:A book? (1)

Anonymous Coward | about 2 years ago | (#42155841)

You should really check out the book. These guys are all over the place, it's totally wacked out. I can hardly believe it was published by MIT Press.

Really? (5, Insightful)

Multiplicity (2498210) | about 2 years ago | (#42155741)

Frontpage slashdot story with a 10 GOTO 10 and saying it's not a loop?

Dudes, just what the fuck. I ask you that.

Re:Really? (2, Funny)

Anonymous Coward | about 2 years ago | (#42156111)

It's a step up from the plastic on Mars story a few days ago.

A slow day on /. ? (1)

Monoman (8745) | about 2 years ago | (#42155743)

1) It is an endless loop created by the GOTO command.
2) Is it a maze or does it just look like one? There is no indication that it actually creates a maze each and every time. It is more likely a pseudo random pattern that LOOKS like a maze.

Re:A slow day on /. ? (1)

mysidia (191772) | about 2 years ago | (#42155819)

Is it a maze or does it just look like one?

It is a maze. It doesn't necessarily have exactly one solution (It probably has more than one). It doesn't necessarily have any solutions.

The loop never seems to terminate, so it seems that the maze will keep getting larger until the program is manually aborted

no loop? goto? helloooo (-1)

Anonymous Coward | about 2 years ago | (#42155747)

Come again

Cue the morons screaming Goto is evil. (0)

Anonymous Coward | about 2 years ago | (#42155753)

Honestly, just don't.

The entire basis of the OS you are using is filled with them. Yes, Linux too.
Most of them are just contextual Gotos in the end, same thing. (in fact, there is literally some cases of actual Gotos since the other command-sensitive versions don't fit the roles)

Goto isn't evil, the developers who (ab)use it are.

Discuss.

No, not Linux too ... (1)

Zero__Kelvin (151819) | about 2 years ago | (#42156141)

"The entire basis of the OS you are using is filled with them. Yes, Linux too."

I guess you've never looked at the Linux source code. There certainly are a (very) few gotos, but it is certainly not "filled" with them. They are very rare indeed.

Bullshit code (0)

Anonymous Coward | about 2 years ago | (#42155755)

The code selects at random one of two characters, which when printed at random may look like maze walls, and then prints them. Rince and repeat.

So basicallly it only prints garbage which was carefully selected. You get the same effect from any programming language which supports unicode, by randomly printing out unicode code points from the U+2500 - U+257f range [utf8-chartable.de] .

Cute, but... (1)

rbprbp (2731083) | about 2 years ago | (#42155757)

... what about a solvable maze?

Without the use of a loop (0)

Anonymous Coward | about 2 years ago | (#42155759)

So apart from the loop from the goto then.

Multi-Fail (3, Interesting)

SuperCharlie (1068072) | about 2 years ago | (#42155767)

This article fails in English and fails in the content. Booya.

Re:Multi-Fail (4, Interesting)

Chelloveck (14643) | about 2 years ago | (#42155905)

The article reads to me like a sophomore-level paper deconstructing some insignificant piece of drivel and claiming great insights into human nature.

"What can this one line -- '10 PRINT,' to use the authors' shorthand -- teach us about software, and culture at large?"

Damn! And that's just the review, I can't even imagine what the actual 294-page book must be like. Next up I expect a 500-page treatise on Vogon poetry.

Re:Multi-Fail (0)

Anonymous Coward | about 2 years ago | (#42156009)

"What can this one line -- '10 PRINT,' to use the authors' shorthand -- teach us about software, and culture at large?"

A: Software is written by fucking morons who don't even know what constitutes a loop.
B: Culture - if this constitutes culture - is shit.

Re:Multi-Fail (0)

Anonymous Coward | about 2 years ago | (#42156137)

This article fails in English and fails in the content. Booya.

Give them a break, it's obvious they've been on a very long acid trip.

A C=64 emulator if you want to try it... (1)

mapuche (41699) | about 2 years ago | (#42155771)

http://codeazur.com.br/stuff/fc64_final/

Cellular automata (0)

Anonymous Coward | about 2 years ago | (#42155787)

The impressive part of this is that they managed to fluff just one recursive rule into an entire book.

If Wolfram gets such bad reviews for stating the obvious of cellular automata after many thousands of experiments, why should we pay any attention to someone that has done just one?

/., in collaboration with the Erowid Vault (2)

Press2ToContinue (2424598) | about 2 years ago | (#42155843)

/., in collaboration with the Erowid Vault. brings you "get high and watch this code run." Wow, it's so cool.

Okay, let me make sure I'm up to speed here... (0)

Anonymous Coward | about 2 years ago | (#42155849)

So, printing / and \ in a randomish sequence makes what looks to be a maze. Oh, and having code jump to itself is apparently not a loop. Did I miss anything?

How did this make it on slasdot? (0)

Anonymous Coward | about 2 years ago | (#42155885)

Seriously, this is all a joke, isn't it? There is nobody back there monitoring this shit, is there?

One line (0)

Anonymous Coward | about 2 years ago | (#42155889)

Almost all code can be put into a single line, don't see what' amazing about that.

80s Flashback (2)

JoeCommodore (567479) | about 2 years ago | (#42155971)

I remember doing that in 1980something on the PET (maybe not that line, but the logic was the same). IIRC it was a type-in along with a bunch of other cheap BASIC graphics routines in a Creative Computing - later I'm sure it showed up in RUN or Transactor for the VIC/64.

It was cool for maybe a couple hours... along with thoughts of what games could I use it with (that's how we developed game ideas old-school style, starting with cool little snippets like this.)

Single line of code? (-1)

Anonymous Coward | about 2 years ago | (#42155989)

So not only did the person submitting the summary not know what a loop is, he also does not understand what a single line of code is. This is most definitely 2 lines of BASIC, not one.

Tricks with Slash and Backslash (1)

localman (111171) | about 2 years ago | (#42155997)

Watching the video it occurs to me that the interesting part is that if you randomly print out slashes or backslashes endlessly, you create an endless "maze". It works particularly well on the c64 because the printable graphics set includes a slash and backslash that have no spacing around the character. But you can do the same thing in a terminal like this:

    perl -e 'while (1) { print rand() > .5 ? "/" : "\\" }';

Although depending on your font it won't look as compelling as the c64 version.

Re:Tricks with Slash and Backslash (3, Funny)

discord5 (798235) | about 2 years ago | (#42156081)

perl -e 'while (1) { print rand() > .5 ? "/" : "\\" }';

Quick, claim it doesn't have a loop and write a book. :)

A meditation (3, Informative)

LihTox (754597) | about 2 years ago | (#42156045)

From page 4 of the book:

This book is unusual in its focus on a single line of code, an extremely concise BASIC program that is simply called 10 PRINT throughout. Studies of individual, unique works abound in the humanities. Roland Barthes’s S/Z, Samuel Beckett’s Proust, Rudolf Arnheim’s Genesis of a Painting: Picasso’s Guernica, Stuart Hall et al.’s Doing Cultural Studies: The Story of the Sony Walkman, and Michel Foucault’s Ceci n’est pas une pipe all exemplify the sort of close readings that deepen our understanding of cultural production, cultural phenomena, and the Western cultural tradition. While such literary texts, paintings, and consumer electronics may seem significantly more complex than a one-line BASIC program, undertaking a close study of 10 PRINT as a cultural artifact can be as fruitful as close readings of other telling cultural artifacts have been.

In short, this is not a programming book, but it appears to be a book of cultural anthropology about programming. Or perhaps a meditation which starts with one simple starting point and branching out in many different directions. Criticizing the program "10 PRINT" as trivial rather misses the point, I should think.

Bad Summary (0)

fast turtle (1118037) | about 2 years ago | (#42156059)

as the Goto 10 is a loop statement w/o end.

Well... (1)

fabioalcor (1663783) | about 2 years ago | (#42156067)

At least it would make a nice geeky retro screensaver.

What is loop? (1)

Anonymous Coward | about 2 years ago | (#42156091)

Slashdot don't hurt me
Slashdot don't hurt me
no more.

Load More Comments
Slashdot Login

Need an Account?

Forgot your password?