
10 PRINT CHR$(205.5+RND(1)); : GOTO 10 (2012) - ghosthamlet
http://10print.org/
======
skrebbel
It bothers me way more than it should that this line of code has become known
as "10print". Like, 95% of BASIC oneliners out there start with "10 PRINT".
It's like calling a McDonald's Super Size Big Tasty Meal With Diet Coke And A
Side Salad a "Mac".

It should've been called 205.5+RND or something. Grmbl.

~~~
bdowling
It’s like using “Dear” to refer to some particular famous letter.

~~~
skrebbel
That's the analogy I was looking for. Thanks!

------
th0ma5
Video here [https://youtu.be/m9joBLOZVEo](https://youtu.be/m9joBLOZVEo)

~~~
flohofwoe
Live version here ;)

[https://floooh.github.io/tiny8bit/c64.html?input=${wait:200}...](https://floooh.github.io/tiny8bit/c64.html?input=${wait:200}10%20PRINT%20CHR%24\(205.5%2BRND\(1\)\)%3B%20%3A%20GOTO%2010%0ARUN%0A)

------
snek
[https://snek.dev/10print](https://snek.dev/10print) :)

~~~
shrimpx
Should fix the line height so the lines connect to each other.

~~~
snek
which browser doesn't show that right? chrome and firefox have connected lines
for me

~~~
bananicorn
Firefox doesn't - but it probably falls back on system fonts for me - there
the line height needs to be at around 1.15em...

Not that that helps in any way, since you never know which font might be
used^^

------
caf
You can recreate the magic in bash:

    
    
      while true; do printf "\u$((2571 + ($RANDOM & 1)))"; done

~~~
Nursie
Doesn't quite work on my mac :/

~~~
mojuba
Got it! This works on macOS. It encodes the same characters in hex UTF-8:

    
    
       while true; do printf "\xe2\x95\xb$((1 + ($RANDOM & 1)))"; done

~~~
Nursie
Excellent work! Thankyou, that's awesome and very fast....

------
dang
2017:
[https://news.ycombinator.com/item?id=15680668](https://news.ycombinator.com/item?id=15680668)

2012:
[https://news.ycombinator.com/item?id=4856207](https://news.ycombinator.com/item?id=4856207)

------
bufferoverflow
Javascript version:

    
    
        for (let i=0;i<10000; i++) document.write(String.fromCharCode(9585 + Math.random()*2) + (i%100 == 99 ? '<br>':''))
        const  b = document.body.style;
        b['font-family'] = 'Courier New';
        b['font-size'] = b['line-height'] = '16px';
    

[https://jsfiddle.net/qxjdtru6/](https://jsfiddle.net/qxjdtru6/)

And a fun curvy variation:

[https://jsfiddle.net/qxjdtru6/1/](https://jsfiddle.net/qxjdtru6/1/)

------
amasad
Wrote it in JS at [http://10print.art](http://10print.art)

Source: [http://10print.art/__repl](http://10print.art/__repl)

------
rzzzt
This Maze Does Not Exist: an AI-powered labyrinth generator

~~~
julianj
I snickered at first but couldn't stop imagining ways to implement this.
Thanks for giving me something to kickstart my brain today.

~~~
skinner_
I'd start with
[https://github.com/mxgmn/WaveFunctionCollapse](https://github.com/mxgmn/WaveFunctionCollapse)

------
ssdsa
In 2013, I recreated the output as a shader in ShaderToy:
[https://www.shadertoy.com/view/ld23DW](https://www.shadertoy.com/view/ld23DW)

------
AndrewKemendo
For powershell:

for(){Write-Host(Random("\","/"))-N}

------
jquinby
Nice. This brings back some great memories. I used to do a similar one-liner
that alternated between white and black blocks, which created crossword-
puzzle-like patterns. I'd sit across the room and squint at the display,
hoping to see some sort of emergent pattern.

------
jypepin
I also built something in JS inspired by 10print with some customisation
[https://jauny.github.io/10print/](https://jauny.github.io/10print/) :)

------
zestyping
Alas! I was hoping the pattern would change every time I refreshed the page.

------
rkagerer
Love it! Brings up so much nostalgia from the days of programming on my old
TRS-80. But is it really a maze? Once you start, you don't seem to get much
choice of path...

~~~
Kurtz79
Of course not, there is no logic behind it, save for printing "walls" that
line up with each other.

It's a (neat) graphic trick.

~~~
tromp
My maze generator at
[http://tromp.github.io/pearls.html#maze](http://tromp.github.io/pearls.html#maze)
produces arbitrarily long proper mazes on the fly. After compiling and
running, enter -1 as the requested height.

------
rbanffy
A nice companion to
[https://nostarch.com/hemingway](https://nostarch.com/hemingway)

------
svendahlstrand
That's a great read! The book inspired me to port that BASIC one-liner to Game
Boy flavored assembly. Still having a Game Boy lying around? Now you have
portable mazes:

[https://github.com/svendahlstrand/10-print-game-
boy](https://github.com/svendahlstrand/10-print-game-boy)

------
mycall
This was my favorite thing to do on TSR-80s at Radio Shack, then walk away,
although I would do all characters instead.

------
pantulis
In the same book, an old one-liner called "BURROW" from Pet Gazette:

1A$="[up][down][left][right]":PRINTMID$(A$,RND(.5) _4+1,1)
"_[left]";:FORI=1TO30:NEXT:PRINT"[rvson][space][left]";:GOTO1

------
HocusLocus
Frogger, TRS-80 Model 1

[https://www.youtube.com/watch?v=wh7gRoYgUpc](https://www.youtube.com/watch?v=wh7gRoYgUpc)

------
neatcoder
Is there anyone here who still writes code in BASIC? If so which
interpreter/compiler do you use?

~~~
gushie
I do so professionally. Our 35+ year old application is written in what was
once VAX BASIC running on OpenVMS (Now on Integrity and called HP BASIC).

~~~
neatcoder
Wow! Can you share your story more? What does your application do? Why did you
choose BASIC 35 years ago? Did the question about rewriting it another
language come up anytime? How did such discussions go? Do you enjoy writing
BASIC code?

~~~
gushie
I've been with the company 20 years so wasn't involved in the original
decision. I believe the company started out on PDP's before moving to MicroVAX
(and later Alpha and Integrity). BASIC will likely have been the best fit at
the time. It is business software for the Agri industry, originally a terminal
text entry system. Now we also have a web front end (running on Windows IIS,
communicating to VMS/BASIC via Apache Tomcat/WSIT webservices). We did try
converting to VB6 back when it was a thing, but then .NET happened so we
abandoned it as conversion to VB.NET wasn't so straight forward. A rewrite in
C# was briefly considered before finally going for the web front end/web
services option to avoid rewriting the BASIC business/data layer. Sadly the
application will go end of life in a couple of years, as we're now part of a
larger corporation who have similar applications. Ours lost out due to the
OpenVMS layer being a hard sell to new customers. I've never really thought
about when I enjoy it! It's mostly a data entry / reporting application, so
generally not very exciting :)

------
golergka
A bit disappointed that this page doesn't generate the maze with each visit

------
kazinator
This is poorly documented; I don't see a REM statement.

------
SeanLuke
Why the 205.5? Why wouldn't this work as 205 + RND(1)?

~~~
scbrg
RND(1) returns a value between 0 and 1, but always lower than 1. Thus, the
result of 205+RND(1) will always be 205 point something, which in turn will be
truncated to 205. Thus, it will always result in the same character.

~~~
SeanLuke
I see. RND returns a float.

~~~
soneil
It's more that the decimal is always rounded down. So you don't want a value
between 205 and 205.9999999, as it'll always be rounded down to 205. you want
a value between 205.5 and 206.49999999, so when rounded down it has a
(practically) even chance of landing on either 205 or 206.

------
fnord77
this book reads like an article on a modern art piece.

------
jesuslop
Lacks randomize()

~~~
DanBC
I think Commodore BASIC had a more complex way of seeding the random timer:
[https://www.c64-wiki.com/wiki/RND](https://www.c64-wiki.com/wiki/RND)

    
    
        POKE 56328,0    : REM real-time clock activate with 1/10s -> clock runs ($DC08)
        PRINT RND(0)    : REM Random number addicted by timer and real-time clock

~~~
Voltage
You could also do I=RND(-TI)

Providing a neg number to RND would "reseed" the random number generator. TI
was a "system" variable that updates every 60th of a second.

------
rahimiali
tl;dr: the output looks like this:
[https://ibb.co/Ypp9DZ3](https://ibb.co/Ypp9DZ3)

~~~
edoceo
Why does ibb need to know my location to serve an image?

~~~
hombre_fatal
It's requesting permission to send notifications, not your location. And it's
because it loads
[https://cdn.siteswithcontent.com/js/push/subscribe.js?v=1.1....](https://cdn.siteswithcontent.com/js/push/subscribe.js?v=1.1.0)
whatever that's for. That domain is on various adblock lists.

