frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Print, a one-line BASIC program

https://10print.org
71•NKosmatos•3d ago

Comments

chrismorgan•2d ago
Current submission title “Print, a one-line BASIC program” is not great. Title from the page:

  10 PRINT CHR$(205.5+RND(1)); : GOTO 10
Could also be something like “10 PRINT: a book about a one-line Commodore 64 BASIC program” (taken from the first sentence with “is” changed to a colon).
kstrauser•2d ago
From the text: “10 PRINT is a book about a one-line Commodore 64 BASIC program, published in November 2012.”

10 PRINT is their official shortened version.

mryall•1d ago
TLDR: the program prints a pseudorandom sequence of characters 205 and 206, which on Commodore 64 are graphics characters similar to / and \.

When repeated across multiple lines, it looks like an intricate random maze. But it is actually just a visual representation of whatever PRNG is used on the platform, with the default seed as set by the BASIC interpreter.

https://sta.c64.org/cbm64pet.html

NKosmatos•1d ago
Hey what happened to my submission title? I swear it started with “10 PRINT”. Perhaps a mod/admin changed it, but I don’t have an option to edit it now.
kristianp•1d ago
It's automatically removed to reduce the prevalence of listicles on the front page.
6581•1d ago
I'd recommend always checking submission titles afterwards because the auto-filter often butchers them. You can edit them at least for a few minutes.
kstrauser•2d ago
This is indescribably beautiful. Thanks for sharing it! It went straight to the top of my reading queue.
gabrielsroka•2d ago
See also https://youtu.be/34CXQr5OLas
hdgvhicv•1d ago
For those that don’t know ascii off the top of the head, it prints either a forward or backward slash repeatedly, which in the c64 font creates a pretty art piece like the graphic at the bottom of the screen.
ksherlock•1d ago
And for those who do know ASCII off the top of their head, it's actually PETSCII. 205 (0xcd) is a right diagonal and 206 (0xce) is a left diagonal.

ASCII / (0x2f) and \ (0x5c) has three problems:

1. They're not as conveniently located (chr$(47+(rnd(1)*45) isn't quite as pretty)

2. They don't fill up character cell so there are gaps in the "maze"

3. PETSCII doesn't have a \ (0x5c is £)

weinzierl•1d ago
Back in the day computer mags had 20-liner competitions. The objective was to cram as much functionality into 20 lines of BASIC and people did amazing stuff with that.

To use the space as best as possible lines were filled to brim and BASIC commands abbreviated. PRINT was ? and other command abbreviations contained PETASCII characters that don't even have a Unicode equivalent[1].

The Commodore 64 particularly had square[2] 8x8 pixel characters and a line on the screen was 40 of them in a row. A logical line from the BASIC interpreter's perspective was still 80 characters long though, which made the program effectively 40 screen lines high.

You see, where this is going. The perfect 20-liner was close to a 40 by 40 square of character salad.

[1] They were one letter and a shifted letter, which could be displayed as symbol depending which mode you were in. They were printed expanded when listing the program. Everything was a bit complicated.

[2] Almost. Pixels were not perfectly square, with the aspect ratio depending on PAL or NTSC.

dspillett•1d ago
> Back in the day computer mags had 20-liner competitions.

In the magazines I remember from my days cutting my programming teeth on an Acorn Electron, there were 10-liners and 1-liners. What some people could squeeze out of 252 bytes was very impressive, even without using extra features (extra graphics primatives for instance) found in other models like the Master series.

selcuka•1d ago
There is a 10-byte assembler (Intel) port of the same program:

https://trixter.oldskool.org/2012/12/17/maze-generation-in-t...

richardfey•1d ago
I tried this on all the basic interpreters available on Ubuntu (yabasic, sdlbasic, basic256 and bwbasic), couldn't get it to work on any of them.

In a couple cases the only remaining issue was the lack of a RND() function definition

anta40•1d ago
What about freebasic? I know it's a compiler, though.
ethan_smith•1d ago
Try `10 PRINT CHR$(205.5+RND(0)1); : GOTO 10` in yabasic or `10 PRINT CHR$(47+INT(RND(1)2)*45); : GOTO 10` in most modern BASIC dialects, which explicitly chooses between '/' (47) and '\' (92) characters.
drzhivago•1d ago
The referenced book was so good until the “considered harmful” sections. As it indicates, GOTO is basically JMP, and I’m sorry if someone is offended by BASIC, but it’s not only the subject of the book but was the promoted language to the masses for early microcomputers, such that people would buy the related BASIC book at the store, along with the computer.
Stratoscope•1d ago
My first summer job was a $2/hour "Night Operator" at Transdata, a Phoenix timesharing company. They shut down their timesharing service at night, so after running a few batch jobs, I had the SDS Sigma 5 all to myself.

We had a few one-card programs, some fun, some useful. A single card held 80 bytes of machine code.

The Sigma 5 had a small speaker on the front panel that you could toggle between two states to move the cone in or out. How often you toggled it determined the pitch of the sound.

One card was called BIRDS. It toggled the speaker to make it sound like several birds chirping at each other.

A more useful one was PRINT. You put it in front of a deck of cards, ran the deck through the card reader, and it would print the deck.

It was a bit slow, because it used a single memory buffer:

  1. Read card 1
  2. Print card 1
  3. Read card 2
  4. Print card 2
  5. Read card 3
  6. Print card 3
  etc.
In other words, at any moment either the card reader or the printer would be operating, not both.

I studied the code and found there were just enough bytes left out of the 80 to implement double buffering by flipping a buffer pointer at each step:

  1. Read card 1 into buffer A
  2. Print card 1 while reading card 2 into buffer B
  3. Print card 2 while reading card 3 into buffer A
  4. Print card 3 while reading card 4 into buffer B
  etc.
Twice as fast!

PuTTY has a new website

https://putty.software/
101•GalaxySnail•2h ago•60 comments

The future of large files in Git is Git

https://tylercipriani.com/blog/2025/08/15/git-lfs/
295•thcipriani•10h ago•118 comments

AI is different

https://www.antirez.com/news/155
176•grep_it•2d ago•167 comments

Best Practices for Building Agentic AI Systems

https://userjot.com/blog/best-practices-building-agentic-ai-systems
85•vinhnx•3h ago•43 comments

I accidentally became PureGym’s unofficial Apple Wallet developer

https://drobinin.com/posts/how-i-accidentally-became-puregyms-unofficial-apple-wallet-developer/
263•valzevul•19h ago•53 comments

Show HN: Edka – Kubernetes clusters on your own Hetzner account

https://edka.io
299•camil•12h ago•93 comments

Occult books digitized and put online by Amsterdam’s Ritman Library

https://www.openculture.com/2025/08/2178-occult-books-now-digitized-put-online.html
369•Anon84•14h ago•142 comments

Do Things That Don't Scale (2013)

https://paulgraham.com/ds.html
297•bschne•15h ago•93 comments

Deep-Sea Desalination Pulls Fresh Water from the Depths

https://www.scientificamerican.com/article/deep-sea-desalination-pulls-drinking-water-from-the-depths/
24•noleary•3d ago•2 comments

OpenBSD is so fast, I had to modify the program slightly to measure itself

https://flak.tedunangst.com/post/is-OpenBSD-10x-faster-than-Linux
150•Bogdanp•11h ago•111 comments

ADHD drug treatment and risk of negative events and outcomes

https://www.bmj.com/content/390/bmj-2024-083658
215•bookofjoe•15h ago•262 comments

Prompting by Activation Maximization

https://joecooper.me/blog/activation/
4•thatjoeoverthr•2d ago•0 comments

Launch HN: Embedder (YC S25) – Claude code for embedded software

85•bobwei1•12h ago•38 comments

The electric fence stopped working years ago

https://soonly.com/electric-fences/
195•stroz•14h ago•84 comments

Porting Gigabyte MZ33-AR1 Server Board with AMD Turin CPU to Coreboot

https://blog.3mdeb.com/2025/2025-08-07-gigabyte_mz33_ar1_part1/
61•pietrushnic•9h ago•0 comments

TextKit 2 – The Promised Land

https://blog.krzyzanowskim.com/2025/08/14/textkit-2-the-promised-land/
63•nickmain•8h ago•21 comments

Show HN: Prime Number Grid Visualizer

https://enda.sh/primegrid/
81•dduplex•2d ago•38 comments

A privacy VPN you can verify

https://vp.net/l/en-US/blog/Don%27t-Trust-Verify
68•MagicalTux•7h ago•61 comments

Model intelligence is no longer the constraint for automation

https://latentintent.substack.com/p/model-intelligence-is-no-longer-the
49•drivian•15h ago•56 comments

Recto – A Truly 2D Language

https://masatohagiwara.net/recto.html
102•mhagiwara•3d ago•49 comments

ARM adds neural accelerators to GPUs

https://newsroom.arm.com/news/arm-announces-arm-neural-technology
148•dagmx•3d ago•29 comments

A mind–reading brain implant that comes with password protection

https://www.nature.com/articles/d41586-025-02589-5
35•gnabgib•1d ago•18 comments

Bullfrog in the Dungeon

https://www.filfre.net/2025/08/bullfrog-in-the-dungeon/
110•doppp•14h ago•26 comments

Compiler Bug Causes Compiler Bug: How a 12-Year-Old G++ Bug Took Down Solidity

https://osec.io/blog/2025-08-11-compiler-bug-causes-compiler-bug/
124•luu•4d ago•62 comments

Claude Opus 4 and 4.1 can now end a rare subset of conversations

https://www.anthropic.com/research/end-subset-conversations
208•virgildotcodes•10h ago•292 comments

Vaultwarden commit introduces SSO using OpenID Connect

https://github.com/dani-garcia/vaultwarden/pull/3899
160•speckx•17h ago•85 comments

America's Stock-Market Dominance Is an Emergency for Europe

https://www.wsj.com/finance/investing/americas-stock-market-dominance-is-an-emergency-for-europe-627b3221
12•mudil•1h ago•1 comments

Open hardware desktop 3D printing is dead?

https://www.josefprusa.com/articles/open-hardware-in-3d-printing-is-dead/
645•rcarmo•17h ago•393 comments

Is air travel getting worse?

https://www.maximum-progress.com/p/is-air-travel-getting-worse
126•mhb•17h ago•209 comments

Thai Air Force seals deal for Swedish Gripen jets

https://www.scmp.com/news/asia/southeast-asia/article/3320828/us-f-16s-lose-out-thai-air-force-seals-us600-million-deal-swedish-gripen-jets
146•belter•9h ago•192 comments