LECTURE
Coding 101
How a machine reads instructions · what a script is · the five moves · reading what the agent wrote
Coding 101
Arch 51580

By the end of today

  • Describe what a computer does — three operations, repeated, with nothing added.
  • Say what a script is — and why a designer already knows the form.
  • Name the five moves that make up every script you will meet this semester.
  • Trace a loop by hand and predict what it prints before running it.
  • Read a script the agent wrote and decide whether to run it.

A computer does not understand your project. It holds a list of steps and a finger on its place in the list.

Everything that looks like judgment is built on top of that, by doing it a few billion times a second.

Three operations, forever

  • Fetch — read what is in a labeled box.
  • Do — one operation: add, compare, join.
  • Store and step — put the answer somewhere, move down one line.
  • So: it never guesses. An ambiguous instruction does not come back as a question. It comes back as a confident wrong answer.
  • And: it never tires. The thousandth repetition is as exact as the first.

Three kinds of instruction

A recipeA Halprin scoreA script
Who runs itA cookA group of peopleA machine
Ambiguity isTolerated — “season to taste”The point — the score invites variationFatal — it stops, or does the wrong thing exactly
Runs againRoughly the sameDeliberately differentIdentically, every time
Leaves behindA mealAn event, and a record of itFiles, and a readable trace of how they were made
The score and the script sit at opposite ends of one tradition — we come back to this in Cybernetics and Design.

A script is a process, drawn.

A plan abstracts a place so someone else can build it. A script abstracts a procedure so a machine can run it. Same move, different subject.

MOVE 1
Name
scale = 20

Put a value in a labeled box so later lines can use it.

MOVE 2
Repeat
for f in files:

Do the same thing to every item in a set, one at a time.

MOVE 3
Choose
if w > 1920:

Take one branch or the other, by a test you wrote.

MOVE 4
Bundle
def encode(p):

Name a group of steps so you can run it again elsewhere.

MOVE 5
Read & write
img.save(out)

Touch the world outside the script: files, folders, the network.

GH PythonPython 3 Script component · Maths › Script
# Grasshopper fills these three before line 1 runs.# You renamed the inputs; the sliders supplied the values. rise  = 1.0        # from a sliderrun   = 12.0       # from a sliderlimit = 8.33       # from a slider — the ramp limit slope = rise / run * 100     # 8.333333333333332
GH Pythonrise set to List access
slopes = []                  # an empty list to fill for r in rise:                 # one value at a time    slopes.append(r / run * 100) a = slopes                   # three in, three out # add a fourth number to the panel and this still works.# the loop is what stops the script caring how many.
faces = [(1, 20), (1, 12), (3, 10)]steep = 0for rise, run in faces:    slope = rise / run * 100    if slope > 8.33:        steep = steep + 1print("steep:", steep)
What the boxes hold
faces—
rise, run—
slope—
steep—
What it printed

                    

Press Step to move the finger down one line.

GH Pythonthe four bands
if slope < 2:              # under 2% — will not drain    band = "ponds"elif slope < 5:            # 2–5% — comfortable    band = "good"elif slope <= limit:        # up to 8.33% — accessible route    band = "accessible"else:    band = "too steep" # the judgment is not in the "if". it is in 2, 5 and 8.33,# which a person chose, rounded, and typed once.
GH Pythonthe same component, before and after
# Script-Mode — what you have been writing all along.slopes = []for r in rise:    slopes.append(r / run * 100) #  ─── click “Convert To GH_ScriptInstance” ─── class MyComponent(Grasshopper.Kernel.GH_ScriptInstance):     def RunScript(self, rise, run, limit):        slopes = []        for r in rise:            slopes.append(r / run * 100)        return slopes # the three names you typed on the component are the three# parameters of a function. they always were.
Inputs Sliders, geometry, panels
rise · run · limit
→
The script Moves 1–4. All of it in memory, all of it reversible
→
Outputs Values flowing downstream. Still nothing saved
→
Bake The one step that writes into your document
Errorthe component flags it · read it in the editor
TypeError: unsupported operand type(s) for /: 'str' and 'float'     slope = rise / run * 100 # what   — it tried to divide text by a number# where  — the line it quotes back to you# why    — a panel fed "1.0" into rise as characters, and no#          Type Hint was set, so it never became a number# fix    — right-click the input and give it a float Type Hint
GH Pythonslope bands on Existing Grade
import Rhino.Geometry as rg              # 5 · reach outside LOW, MID = 2.0, 5.0                   # 1 · name def band(slope):                      # 4 · bundle    if slope < LOW:      return 0        # 3 · choose    elif slope < MID:    return 1    elif slope <= limit: return 2    else:                return 3 bands = []mesh.FaceNormals.ComputeFaceNormals() for n in mesh.FaceNormals:              # 2 · repeat    slope = (1 - n.Z * n.Z) ** 0.5 / n.Z * 100    bands.append(band(slope)) a = bands                             # 5 · hand it downstream

That is what the agent hands you.

Not pseudocode, not a sketch — a file like that one, in about twenty seconds, from one sentence you wrote. Reading it is the skill that is left.

Writing it yourself vs. directing an agent

You write itThe agent writes it
Time to first versionHours to daysSeconds
What you must knowSyntax, the library, the error messagesWhat should happen, and how to recognise it
Still your jobAll of itSpecify · read · test on real files · decide to keep it
RiskIt does not runIt runs confidently on the wrong files
Who carries itYouStill you — it has no stake in your work

Before you trust it

  • Where do the thresholds live? On sliders you can reach, not typed into the middle of the code. The numbers are the design decision.
  • Are both sides in the same units? A ratio (0.0833) compared against a percentage (8.33) reports every face as flat and never errors.
  • Which way does the comparison run at the edge? > against >= is the difference between a compliant ramp passing and failing.
  • What does it change? In Grasshopper, nothing until you bake. Find the step that writes before you take it.
  • Then: measure three spots by hand. Four minutes, and it is the only part that proves anything.

Where this goes next

  • The agent runs a loop — read the context, plan, write a file, run it, read what came back, revise. Move 2 with a very large body.
  • Which is an old diagram — y = f(y), the cybernetic loop, with a language model in the box. Cybernetics and Design
  • So your leverage is the context — what it reads before it writes. That is the Context Is Design session, and most of this course.

You are not learning to write scripts. You are learning to read them.

A profession that already reads drawings, details and specifications for a living is better prepared for this than it thinks.

Before next week

  • Workshop — Reading a Script — in class, now, in Grasshopper. Predict, then run.
  • D1 — workflow audit — one recent project drawn as a sequence of steps, with the friction marked. This is the raw material for your Part II project.
  • AI Fluency — generative AI fundamentals; capabilities and limitations. Watch before next session.
  • Check your install — Rhino 8 opens Grasshopper, the agent runs, Git knows your name.
/ 21
Workshop 01 — Reading a Script Build the slope component one move at a time, predicting each result before you look — then write the spec for a real slope-band analysis, hand it to the agent, and check what comes back against three measurements of your own.
Open the workshop →