moon-lander nodejavascript.com

It crashes the first time. It is supposed to.

The pilot of this lander is 122 random numbers. It has never seen a moon, it does not know which way is down, and on the first attempt it puts itself into the ground at about eighteen metres a second. Then it does it again. Measured on the run below, in a browser: for the first 174 generations β€” 1,044 attempts, every one of them a wreck β€” nothing lands at all. The first landing arrives at generation 175, and by generation 300 it is putting all six of its moons down on the pad.

That is the whole method β€” a machine that fails in front of you and gets better is worth more than one that never shows you its failures, and a curve drawn from the failures is the only honest evidence that anything was learned.

The moon is the real one: surface gravity 1.62 m/sΒ², a 900 kg stage carrying 300 kg of propellant, an engine that pushes along the body axis so thrusting while tilted shoves you sideways. The physics is the same for every attempt; only the pilot changes.

Hand-written physics Β· one 122-weight network Β· a search with a cooling temperature Β· three charts drawn from the run Β· no library for the learning, no server, no account, no keys.

The attempt you are watching

Starting the search…

The pilot that began this run β€” 122 random numbers β€” scored β€” on the six moons, crashing on every one of them and arriving at a mean of β€”. It landed β€” of them.

Watching paces the search so you can see the curve bend. Fast removes the pacing and finishes the run in about a second β€” the generations are the real ones either way. Show attempt 1 flies the pilot the search started with, so you can compare it with the one it has now.

Altitude
β€”
Vertical speed
β€”
Horizontal speed
β€”
Tilt
β€”
Propellant
Main engine
Attitude jets
Generation
0
Soft landings
0%
Mean touchdown
β€” m/s
Attempts flown
0
Restarts
0
Generations a second
0/s

The learning curve

All three are drawn from the run happening above, at the moment it is at. The generation axis starts at zero with the pilot the page opened with.

Soft landings share of the six moons landed on the pad, inside the envelope 0%
How hard it arrives mean speed at contact, against the 2.2 m/s the legs will take β€” m/s
Score the best pilot so far, on the same six moons every generation β€”

The curves are the best so far, which is what a learning curve is; the search itself wanders, and the generation counter beside the charts is what it actually reached. Training is paced at about sixteen generations a second so the curve can be watched bending β€” the maths manages around a hundred and eighty a second, and Fast removes the pacing. The run is 600 generations, 3,600 attempts flown, about three seconds of arithmetic.

How it works, and what went wrong on the way

What it is paid for

Two things. Per step, the improvement in a number that says how bad the situation is: the fall gravity still has left to deliver from this height, plus whatever sideways drift it has not cancelled, plus how far off centre it is, how tilted it is, and how much propellant it has already burned. At the end, one of two verdicts β€” a hundred for a landing on the pad inside the envelope, and about a hundred less for everything else, whether that is a crater, a gentle arrival somewhere it should not be, or running out of time.

πŸ”΄ This reward took three attempts, and the two that failed are more instructive than the one that works. The first paid a flat bonus for a calm descent β€” and the search learned to hover. It held station just above the ground, burned the tanks, let the clock expire, and scored better than crashing, so it did that every time while every chart said it was improving. It was learning the wrong thing very well.

The second version replaced that with the honest article β€” the speed it would hit the ground at, which pays for slowing down at any altitude β€” and it made the search worse. Measured across twelve seeds the mean landing rate fell from about sixty per cent to about thirty, and it never got past two thirds of the moons. Vertical speed is the one thing the lander can spend propellant to change, so paying for it pays for braking early, and the tanks are then empty at the moment the braking is actually needed. A term that reads as prudence taught the search to squander its margin.

What survived is the third version, and the difference is that it says nothing about how fast the lander happens to be falling right now. It pays for getting down and for killing the sideways drift; everything about arriving gently is left to the verdict at the end, where getting it wrong is worth a hundred rather than a hundredth. All three are in the repository's history.

What it can see

Nine numbers, and nothing else: altitude, vertical speed, horizontal speed, where it is over the site, tilt, spin, propellant left, the slope of the ground beneath it, and how many seconds of falling are left. The last one is the only concession to sense β€” a descent computer with a radar altimeter computes exactly that β€” and it is the term that makes the task learnable at all. Measured: without it the search plateaus at a sixth of the moons and never leaves. What it still has to discover for itself is where the threshold is, how hard to brake, how to spend a fixed fuel load, and how to do all three while drifting sideways.

How it searches

A walk, not a gradient. It tries six small variations of the current pilot on the same six moons, keeps the best, and moves there β€” taking a worse move now and then, with a probability that starts generous and cools to nothing. Taking only the moves that improve the score was tried first and it stops dead: measured across two dozen seeds it settled at half the moons and never moved again, and the runs that did well had merely started in a good place. A walk that is never allowed downhill can only be lucky.

Two things are tracked, and they are not the same. The walk is the pilot being nudged, and when it stops improving for long enough it is thrown away and a fresh random one takes over. The best is the best pilot ever seen, kept across every walk. The curves above are the best. The restart counter beside the canvas is how many walks were abandoned to get there β€” and on this seed it stayed at zero, which is worth seeing too: the mechanism exists because other seeds need it, not because this run did.

The examination

Six moons, fixed by the seed, and every generation is graded on the same six. That is what makes two generations comparable, and it is also what limits the claim: this is a measurement about these six. A pilot that scores well here has been selected for arriving on the pads it has seen, and nothing on this page says it would survive a seventh.

What this does not prove

It gets all six, on this seed β€” and the margin is thin. The hardest moon is landed on at 1.48 metres a second against an envelope of 2.2. At generation 200 it had landed two of the six and the mean speed at contact across the whole examination was 12.2 metres a second, which is the number the middle chart is plotting: a pilot making real progress, with most of its attempts still arriving fast enough to kill a lander.

A different seed finds a different pilot. The run here is seeded so that you see the same thing twice, and the seed was chosen by measuring two dozen of them in a browser β€” which is a disclosure, not a boast. Across those the mean landing rate is about a third, and several never get past two moons however long they run. Nothing about this page would survive being called a reliable trainer; it is a small honest one.

And the same seed does not give the same run in every browser. The search is chaotic β€” it takes a step, measures it, and takes another β€” so a difference in the last bit of a sine sends it somewhere else entirely. Measured: Node and Chrome from the same seed agree on every individual attempt and still end up with different runs. The seed makes the run repeatable in your browser, which is the honest version of that promise.

The chart is the best so far, so it cannot go down. That is how learning curves are drawn and it is also a way of hiding a search that spends most of its time getting worse. The restart count is the honest companion number, and the walk's own score is in the data if you want it.

Nothing here is a result about the moon, or about machine learning. A 122-weight network and a walk over six seeded terrains is a demonstration of an idea that already works β€” that a policy can be found by trial and measured by failure β€” not evidence about landing anything real. It has no wind, no radar noise, no mass uncertainty, no sensor failure, and no way to notice that it has none of those.

Privacy

Nothing is asked of you and nothing is stored about you. There is no account, no form, no upload and no comment box. The page does not read your clipboard and does not know how long you watched.

The training runs in your own browser. The search is a web worker in this tab: the forces, the attempts and the weights never leave the machine, and they are gone when the tab closes. Nothing is saved between visits β€” reload and the pilot is random again.

Analytics is off until you say otherwise. The Google Analytics tag is not in this page. The consent script adds it only after you press Accept, so a visit that declines makes no request to Google and receives no cookie. Your answer is kept in this browser's local storage rather than in a cookie, and declining is remembered β€” the bar does not return to ask again.

No third-party code runs here. The styles, the scripts and the icons are all served from this domain, and the fonts are the ones already on your machine. The only outside request this page can make is the Google Analytics tag, and only after you accept it.

What this page is not. It is not a simulation of a real vehicle and not a result about anything but itself. Do not fly it anywhere.