Web Technologies 2026 · BiUH · Exercise · Session 6

The Useless
Machine

A website toy — simple, surprising, endless. Built with AI, understood by you.

webtech.landrock.io

Before anything else

Turn it on.

One switch. Go on.

Try it more than once. Try it with the keyboard: Tab, then Space.

What is a useless machine?

A box with one switch.

  1. You flip the switch on.
  2. The lid opens. A hand comes out.
  3. It flips the switch off.
  4. The hand goes back. The lid closes.

1952. Marvin Minsky imagines it at Bell Labs and calls it the ultimate machine. Claude Shannon — the father of information theory — builds one and keeps it on his desk.

"a machine that does nothing — absolutely nothing — except switch itself off"

— Arthur C. Clarke, after seeing it, Voice Across the Sea, 1958

Seventy years later people still build them — and still laugh every time.

The real thing · ten seconds

Watch it once.

A useless machine on a kitchen table. Sound on.

The hand does not hurry, and it never misses. Now notice the part of you that wants to press it again.

1960s · sold by mail order

A 1960s magazine advertisement headed 'Monster inside the Box'. A black box with a switch on top; a hand reaches out from under the lid to push the switch. The text describes a mysterious, sinister box whose green hand switches itself off, for $4.95 plus 25 cents postage, from Captain Company, Philadelphia.
Scan: dughandler.blogspot.com

"Monster inside the Box" — $4.95.

"You throw the Switch to 'ON' … the lid slowly rises … The GREEN HAND grabs the switch, pushes it to 'OFF' and quickly disappears back into THE BOX."

— the advertisement

One switch. A surprise. Back where it started. A laugh — and a shiver. All four properties, sold as a toy, sixty years before you build yours.

"Once seen, this is never forgotten." That is the bar for your version too.

What makes one

Four properties.

1Simple

One control. Nobody needs instructions.

2Unexpected

It does something you did not ask for.

3It starts over

It ends exactly where it began — ready to go again. Forever.

4Fun, and deep

You laugh first. Then you wonder what it means.

Leave one out and it is a different thing: a game, a prank, or just a broken button.

Why it is not as useless as it looks

Most of the web is built to keep you clicking.
A useless machine is built to make you stop.

It has no goal, no score, no feed. It asks one question: why did you press it again?

On the web, it could be …

The machineWhat it might be saying
a button that runs away from your cursoryou always want what you cannot reach
a progress bar that reaches 99 % — and starts againfinished is a feeling, not a state
an "I agree" box that unticks itselfdid you actually read it?
a to-do list that deletes each task as you add itthe list was never the work
a lamp that goes dark when the mouse comes nearsome things only exist unobserved
a big red button that says "Do not press"you were always going to press it

Ideas to think with, not a menu. And the switch is taken — invent your own. On a phone there is no mouse: what does yours do there?

Every useless machine is a state machine

Draw the loop before you build it.

waitingswitch off
you flip it →
onfor a moment
it reaches out →
off againhand returns
↺ and it is waiting again — the exact state it started in

A state is what the machine is right now. An event is what moves it on. Property 3 means one thing: the last state is the first state.

If you cannot draw your loop in three or four boxes, it is not simple yet.

The brief

One page. One control. One surprise. Back to the start.

Built with AI. Explained by you — every line, when asked.

You already know every part of this

You needFromIn your machine
a real <button> or <input>, with a <label>lesson 2the one control — Tab reaches it, Space works
classes, transition, transformlesson 3how it looks, and how it moves
one more link in nav.htmllesson 4the machine is a page of your site
events, state, setTimeoutJavaScriptwhat it does — and when
a precise prompt · read · test · commitrecap, part 6how you build it

This is the first exercise where you decide what to build. The parts are all familiar.

Step 1 · on paper, not in VS Code

Sketch it first.

  1. The control. What is the one thing a person can do?
  2. The surprise. What happens that they did not expect?
  3. The way back. How does it return to the start?
  4. The sentence. What is it saying?

Four boxes and some arrows. Then open the AI — you will know exactly what to ask for.

A prompt is a specification. You cannot specify what you have not decided.

Step 2 · describe it · fill in the brackets

Build a useless machine as one web page: machine.html, machine.css and machine.js, in my my-site folder.

The control: [one button / switch / slider / text field …]
When the user [does what], the machine [the surprise].
Then it [how it returns to the start], ready to be used again.

Rules:
- HTML, CSS and plain JavaScript only. No libraries, no frameworks.
- The control is a real <button> or <input> with a <label>, so it works with the keyboard.
- It must work on a phone: nothing may depend on hover alone.
- Add a link to machine.html in nav.html. Change nothing else on my site.
- Explain every line of the JavaScript.

The rules are the part people leave out — and the part that keeps your site intact.

The template, filled in · the classic

Build a useless machine as one web page: machine.html, machine.css and machine.js, in my my-site folder.

The control: one on/off switch, made from a checkbox.
When the user switches it on, the machine waits half a second, then a hand slides in from the side and switches it off.
Then the hand slides back out, ready to be used again.

Rules:
- HTML, CSS and plain JavaScript only. No libraries, no frameworks.
- The control is a real <input type="checkbox"> with a <label>, so it works with the keyboard.
- It must work on a phone: nothing may depend on hover alone.
- Add a link to machine.html in nav.html. Change nothing else on my site.
- Explain every line of the JavaScript.

This is the machine on slide 2. It is here to show the template working — not for you to build.

Step 3 · iterate · one change at a time

The first version works. Now give it a personality.

Make the machine wait a little longer each time it is switched on, as if it is getting tired.
After the tenth time, let the machine give up and stay on — for three seconds. Then it switches off as usual.
If the user has reduced motion turned on, keep the joke but remove the movement. Use prefers-reduced-motion.

Commit before each one. Read what changed. Test it. Keep it — or undo it.

Before you show it

Check it like a stranger would.

"Click during the surprise" is where most machines break. That is a state bug — and now you know what to call it.

In class · sixty seconds each

Show it without explaining it.

  1. Hand it to someone. Say nothing.
  2. Ask them: what is it saying?
  3. Then tell them what you meant — and which line of code makes the surprise happen.

If they laughed, it works. If they are still thinking about it afterwards, it really works.

Exercise · session 6

Build something useless.
Build it well.

webtech.landrock.io/sessions

← → navigate · F fullscreen · P print · Copy never turns the page