Unit 1.1 slides: software lifecycle, umbrella activities, task sets, SDLC methodologies, and the four Ps. Shown from a copy of the bookSHelf deck kept in this site.
How to print values with console.log and how JavaScript runs code top-to-bottom. Read before the A1.2 console lab.
Open the browser console, run five ready-made statements, then change two of them to print your own text. Auto-graded.
Learn what a program is, then write six lines of JavaScript with console.log(): text, math, joined strings and a true/false comparison, and watch them run in order.
A ~6-minute overview of the whole software development lifecycle. Watch before The Four Phases reading so you can see the shape of a project before naming its parts.
Read about process models and the four framework activities before you classify project tasks in the next lab.
Read each task from a school-lunch app and log which of the four phases it belongs to. Auto-graded.
Read about umbrella activities: the work that runs alongside every phase, before the Name That Umbrella lab.
Read a testing scenario and log which umbrella activity it belongs to. Auto-graded.
Read about software engineering actions: the named jobs inside a phase, before you write a task set.
Read about task sets: the checklist one action needs, before you write a task set of your own.
List a task set for the requirements-definition action. AI-graded with hints.
Read about SDLC methodologies and why teams follow one, before the Four Ps reading.
Read about the four Ps and why two projects elaborate the same framework differently.
Five multiple-choice questions on the four Ps and why two teams elaborate the same framework differently. Checked instantly.
Read about prescriptive process models: an orderly, prescribed sequence, before the reading on where they break.
Read about where prescriptive models break: rigid, inflexible, and poor fits for changing requirements.
Four multiple-choice questions on prescriptive process models and where they break. Checked instantly.
Describe the four framework activities, walk a real product through them, and map them onto the five-phase naming. AI-graded with hints.
Ten multiple-choice questions on the four phases, umbrella activities, actions and task sets, the four Ps, and prescriptive models. Checked instantly.
→ View full module pageVariables and Data Types slides.
Declare variables with let and const, reassign a let, and choose between the two. Read before the variables-and-types lesson.
Eight types, and the whole language is built from them. The map before the tour.
A variable is not locked to one type. Convenient, and the reason a whole class of bug only shows up when you run the code.
Give one variable three different types in a row and print what typeof says each time. Auto-graded.
Whole numbers and decimals are the same type in JavaScript. One type, not two.
Learn arithmetic operators and the biggest JS beginner trap: why "5" + 3 equals "53". Read before the operators-expressions lesson.
Three values that are numbers without being numbers. Definition 1.2.1, and why JavaScript never crashes on bad maths.
Once NaN appears in a calculation it spreads to the whole result. Example 1.2.1, with the one exception.
Four expressions. Write down what you expect, then run them and find out. Auto-graded.
Past 9007199254740991, ordinary numbers stop being exact. Definition 1.2.2 and the n suffix.
Double, single and backtick. Two of them are interchangeable and one is not. Definition 1.2.3.
Drop a variable or a whole calculation into the middle of a string. Backticks only.
Build strings with backtick template literals and use .length, .toUpperCase(), and .includes(). Read before the variables-and-types lesson.
Build a greeting with a template literal, then prove single quotes cannot do the same job. Auto-graded.
Practice arithmetic, string concatenation, and comparison operators.
Exactly two values, and most of them come out of a comparison rather than being typed by hand. Definition 1.2.4.
Four comparisons, four boolean answers, and the habit of reading a comparison as a value.
Deliberately nothing. A type with exactly one value in it. Definition 1.2.5.
What JavaScript puts in a variable you declared but never filled. Definition 1.2.6, and why not to write it yourself.
Tell the two empties apart and say when you'd write each. AI-graded with hints.
Seven types hold one thing each. The eighth holds collections. Definition 1.2.7.
Ask any value what type it is. Definition 1.2.8, and the syntax that looks like a function but isn't one.
Three answers that need explaining, including a bug the language has kept on purpose since 1995.
Run typeof over six different values and find the one answer that lies. Auto-graded.
Understand how to store and work with data using let, const, and typeof.
The whole type system on one page, now that you have met every row of it.
Ten broken variable declarations. Fix each one and say in a comment what was wrong. Auto-graded.
Six variables describing something in the room, printed as a sentence with a template literal. Auto-graded.
A four-minute tour of the whole type system: eight basic types, seven of them primitive, dynamic typing, and the typeof operator, including the one answer typeof gets wrong. Watch after the readings as a second pass over the same ground.
Eight multiple-choice questions on dynamic typing, the seven primitives, and null vs undefined. Checked instantly.
→ View full module pageDocumentation and Coding Conventions slides.
Write every variable name in camelCase, mark never-changing values with const, and see why descriptive names beat short mystery names.
Apply consistent indentation, operator spacing, and semicolons so code is easy to scan.
What single-line and block comments do, and why they matter. Read before A3.1.
Why comments and READMEs matter once more than one person touches the code.
A name should say what it holds without needing a comment. Definition 1.3.1, first rule.
A single letter tells the reader nothing. Definition 1.3.1, second rule, and the one exception.
data and value are too vague to help anyone. Definition 1.3.1, third rule, and the other ditch.
If the team says "user", never write "visitor". Definition 1.3.1, fourth rule: the one that only bites in groups.
Three lines, twice. Nothing about how it runs changes, only how fast a reader understands it. Example 1.3.1.
Two snippets of single-letter code. Rename every variable so each line explains itself. Auto-graded.
Six names, and one that is genuinely borderline. Judge each and say which rule it breaks. AI-graded with hints.
A box labelled "books" that you keep putting shoes in. Book §1.3.2, and the habit to break early.
It saves a little typing and buys you a debugging problem. Also: extra variables do not slow your program down.
Walk a reused variable line by line, then split it. Try It Now 1.3.2, done out loud.
One variable doing four jobs. Give each job its own well-named variable. Auto-graded.
Your teammate wrote cartItems. You wrote basketItems. Say what the problem is and what you do about it. AI-graded with hints.
The one file written for someone who has not read your code yet. Three questions it has to answer.
Twelve lines with no comments, no spacing and terrible names. Fix it to the class style guide and write the README. Auto-graded.
Three minutes on why good variable names matter and why giving one variable several jobs costs more than it saves. Watch after the readings.
Nine multiple-choice questions on naming, comments, documentation and READMEs. Checked instantly.
→ View full module pageProgramming Paradigms and Languages slides.
Languages are purpose driven. "Which is best?" is not a well-formed question: best for what?
Four jobs, four languages. Log the language each job was designed for. Auto-graded.
How much machine detail a language makes you handle, and why hiding it is a choice, not a shortcut.
One runs fast, one is written fast. Definition 1.4.1 and the trade-off behind it.
Five multiple-choice questions on levels of abstraction and picking a language level against a deadline. Checked instantly.
Two programs can solve the same problem and be organised in completely different ways. Definition 1.4.2.
The style you have been writing since §1.2: steps in order, acting on data held somewhere else.
Procedural programming with a discipline attached, and a surprisingly strong claim. Definition 1.4.3, and SLO-2.
The three structures every program is built from, one at a time, with where Chapter 2 teaches each.
Three programs, read one at a time, naming the structures in each. The identification habit, done out loud.
Four described programs. Log which of the three structures each one needs. Auto-graded.
The first example in this course of a restriction being a feature. No arbitrary jumps, and what that buys.
Name the three structures of structured programming and give an everyday example of each. AI-graded with hints.
Bundling data with the behaviour that acts on it. Definition 1.4.4, and why Chapter 5 exists.
Two snippets, same output, different paradigm. What actually tells them apart is not what you'd guess.
Five multiple-choice questions on where behaviour lives in procedural versus object-oriented style. Checked instantly.
Same input, same output, nothing else disturbed. The paradigm that is careful about change.
Some languages commit to one style. JavaScript supports all three, and real programs mix them.
Three snippets, three paradigms. Log which is which, then name what JavaScript itself is. Auto-graded.
A short survey of the language landscape. Watch after the readings, as a second pass over the same ground in someone else's words.
Eight multiple-choice questions on purpose-driven languages, levels of abstraction, and the three paradigms. Checked instantly.
Pick two languages that aren't JavaScript and explain what each is for and why its paradigm fits. AI-graded with hints.
→ View full module pageProgram Design Tools and Environments slides.
A program has two separate difficulties. Typing solves one of them, and doing both at once is why you get stuck.
The bridge between a problem and its solution. Definition 1.5.1, and why a computer cannot do this part for you.
Decomposition, pattern recognition, abstraction, algorithms, and the table analogy that explains why you need all four.
Abstraction, automation, analysis: the shorter framing, and the step people skip.
Five instructions, read back literally by something that knows nothing. Watch where they break.
Write instructions for a task, then find the first one that breaks when read literally. AI-graded with hints.
Redefining one hard task as a set of easy ones. Definition 1.5.2.
Categories are compression. Twelve unrelated facts become three groups you can hold.
The two directions logical thinking runs, and where each one shows up when you are debugging.
Build Table 1.5.1 from nothing, and watch the empty columns tell you what you forgot.
Five multiple-choice questions on decomposition and what makes a part self-contained. Checked instantly.
Keep what matters, discard the rest. Definition 1.5.3, and the one test that decides which is which.
Real systems stack abstractions so each layer minds its own job. You already trust dozens of them.
All four techniques on a problem nobody would call programming, which is the point.
Five multiple-choice questions on abstraction, the drop test, and why it is relative to the problem. Checked instantly.
Explain the four parts of computational thinking in your own words, with a worked example of each. AI-graded with hints.
Finite, ordered, unambiguous. Definition 1.5.4, and why all three words are doing work.
Two ways to write an algorithm down before you write any code: pseudocode in structured English, and a flowchart in three shapes.
One instruction per line, and indent what is inside something else. Definition 1.5.5: that is the whole ruleset.
The voting check, planned before it is coded. Example 1.1, and what the plan deliberately does not say.
The sandwich grows a decision, and pseudocode grows keywords: START, INPUT, IF, THEN, ELSE, OUTPUT.
Five multiple-choice questions on reading a broken plan, indentation, and why nothing running it is the point. Checked instantly.
Five multiple-choice questions on reading pseudocode plans: which is pseudocode, which plan is correct, and what makes a loop end. Checked instantly.
Oval, rectangle, diamond. Definition 1.5.6, and Table 1.5.2: nearly every flowchart is these three.
One way in, two ways out, and the paths rejoin. This is §1.4's selection, drawn.
Neither is better. They are good at different things, and most programmers use both.
Turn plain-English steps into pseudocode: get a number, ask whether it is even, print one of two answers, then end. Your first pseudocode practice, ungraded.
The rule for the rest of the course: every graded build opens with a plan, and the plan goes first. What a plan looks like, what the checks can and cannot see, and how big a plan should get.
Plan the printer-credit rule in pseudocode with the keywords from the reading: take in the pages, ask the question, charge only the pages over 20, and report both answers. The plan comes before the code in 1.5.31.
Turn the plan you just wrote into working JavaScript, and confirm the code matches the plan. Auto-graded.
Three ways the same instructions can be carried out, and why two of them finish sooner.
A process that calls itself on a smaller version of the same problem. Definition 1.5.7: read it, don't write it yet.
Cause the error deliberately, so you recognise it when it happens by accident.
F12, then Console. A scratchpad that forgets everything, which is exactly what makes it comfortable. Definition 1.5.8.
The console is a scratchpad; the editor holds the program. The difference is permanence.
Two expressions, one pair of brackets, and a question answered in four seconds. Auto-graded.
The kind, the detail, the place. Usually the most useful sentence available, and usually skimmed.
Break it, read the three parts, say which one solved it, then fix it. Auto-graded.
You have to know what the answer should be before you can tell that it isn't.
Most bugs never produce a message. Definition 1.5.9, and the two habits that make printing work.
A program that prints 9 instead of 20, found by narrowing rather than by staring.
Three bugs, none of which produce an error message. Narrow them down with labelled prints. Auto-graded.
Three and a half minutes on the four cornerstones of computational thinking, the three words that define an algorithm, and when to reach for pseudocode versus a flowchart. Covers the design half of this module.
Twelve multiple-choice questions on computational thinking, decomposition, abstraction, pseudocode, flowcharts, recursion and debugging. Checked instantly.
→ View full module pagePick one of four problems with your partner and type the plan in pseudocode: take in the numbers, work out one value, compare it against the limit, and report on each side. The build lesson does not open until this one does.
Turn the chart you just passed into a documented, straight-line program. Eight checks, all of them things Chapter 1 taught. AI-graded: press Grade up to three times and your best counts. After your third try you can see how it is solved, once your teacher releases it.
The writeup that goes with the live demo: who did what, three test cases, and where four of Chapter 1's five sections show up in your program. AI-graded with hints.
→ View full module pageEight questions: three on the ideas of Chapter 1, five where you read a short program and say what it prints. Three tries: you see your total after each one, your best try counts, and the marking appears after the last.
Three short answers: umbrella activities, what is wrong with a badly written program that also computes the wrong answer, and high-level against low-level languages. Three tries with feedback on each question; your best try counts.
A book-order receipt with four bugs in it. Repair all four and name what kind each one was. Three tries, feedback on each bug, and your best try counts.
Pick one of three problems and outline it in four short lines, alone: what you take in, the one value you work out, the question you ask, and what you report on each side. Three tries; the AI marks whether the outline answers your problem. Part 5 writes the full steps for the same problem.
Pseudocode for the problem you outlined in Part 4. Plain English arranged like code, one instruction per line, indentation carrying the branches.
→ View full module pageConditionals slides: if / else if / else, comparison operators, the logical operators && || !, and the ternary operator ?.
A short tour of how programs choose a path with if/else. Watch before 2.1.3 Reading, If / Else if / Else.
Learn how to make your code choose a path: if, else if, and else. Read before the conditionals practice lesson.
Turn plain-English steps into pseudocode for an if/else: one question, two labelled answers, and a last line that runs either way.
Write an if statement that logs a message when a number meets a threshold. Auto-graded.
Extend an if statement with an else branch to handle both outcomes. Auto-graded.
Write an else if chain with at least three branches. Auto-graded.
Learn how to put one if statement inside another to ask a follow-up question. Read before the nested-if practice lesson.
Write an if statement inside another if statement to ask a follow-up question. Auto-graded.
Learn the six falsy values and how if converts any value to true or false. Read before the truthy-check practice lesson.
Write an if statement that tests a variable directly, relying on truthy/falsy conversion. Auto-graded.
Learn the six comparison operators and why === is safer than ==. Read before the conditionals practice lesson.
Log four comparison expressions, including at least one ===, and observe the results. Auto-graded.
Fix an if condition that uses a single = where it should compare with ===. Auto-graded.
Learn the ternary operator: condition ? value1: value2. Read before the ternary practice lesson.
Use the conditional operator ? to assign one of two values to a variable. Auto-graded.
Learn how to chain conditional operators to pick from more than two values. Read before the chained-ternary practice lesson.
Chain at least two conditional operators to pick from three or more values. Auto-graded.
Learn the rule of thumb: use ? to pick a value, use if to run different code. Read before the rewrite practice lesson.
Take a ternary used for its side effect and rewrite it as an if/else statement. Auto-graded.
Learn how to combine conditions with AND, OR, and NOT. Read before the conditionals practice lesson.
Write an if statement whose condition combines two checks with &&. Auto-graded.
Write an if statement whose condition combines two checks with ||. Auto-graded.
Use the ! operator to flip a boolean inside an if condition. Auto-graded.
Fix a door-unlock condition that uses || where it should use &&. Auto-graded.
Learn why parentheses make a condition's intent clear even when they aren't strictly required. Read before 2.1.37 Combine &&, ||, and !.
Write one if condition that uses all three logical operators together. Auto-graded.
Predict the output of an else if chain and a chained ternary before running them. Auto-graded.
Given filament type and layer height, print a recommended print temperature using else if and logical operators. Auto-graded.
Stretch problems. Every challenge is required to continue. Auto-graded.
Use score, attendance, and lateAssignments to print a grade recommendation. Auto-graded.
Five multiple-choice questions on === vs ==, operator precedence, and tracing three conditional snippets. Checked instantly.
→ View full module pageUnit 2.2 slides: algorithms and loops.
An algorithm is a precise, ordered set of steps to solve a problem. See how that idea turns directly into code.
An algorithm is the plan. A program is that plan written in a language a computer can run. See the same decision as English, then as JS.
Four shapes carry nearly every flowchart. Learn what each one means and the two rules that make a flowchart readable, before you draw one.
Turn the largest-of-three algorithm into pseudocode: two checks in a row, each one a question, with the no answer still carrying on to the next step.
Turn a written ticket-price algorithm into numbered pseudocode: get the age, one question with two answers, and print the price. Green here unlocks the 2.2.8 A2.2.1 (Part A) plan.
Define algorithm in your own words, then write a precise numbered algorithm for an everyday task. AI-graded.
Learn the three-part for loop: init, condition, increment. Count to five, then sum a range: the two moves you'll use everywhere.
Turn the sum-1-to-5 loop into pseudocode: start the total before the loop, add i inside it, and print after it ends.
Write a for loop that logs every integer from 1 to 10. Auto-graded.
A while loop checks its condition before every run. Learn when to choose it over for, and how to avoid an infinite loop.
Write a while loop that counts down from 10 to 1, logging each value. Auto-graded.
Write a JS program with at least one for loop and one while loop that solves a counting or accumulation problem. Auto-graded.
A plan arrives with one missing idea: the rider-height check only says what happens when the rider is tall enough. Read the cards, find the gap, and repair it.
Loop through a string and count how many times one letter appears. Auto-graded.
A canonical algorithm is a well-known pattern worth knowing by name. Meet linear search: check one item at a time until you find what you're looking for.
Stretch problems. Every challenge is required to continue. Auto-graded.
→ View full module pageUnit 2.3 slides: the switch statement.
See why a long else-if chain that keeps testing the same variable is a sign JavaScript has a better tool for the job. Read before 2.3.3 Reading: switch Statements.
Learn how a switch statement picks one case from many without a long if/else chain. Read before 2.3.4 Worked Example: A Menu of Options.
Turn plain-English steps into pseudocode for a three-case switch: three questions in a row, a break after each case, and a last line that runs either way.
Write a switch that prints the sound an animal makes, with a default for anything else. Auto-graded.
Write two switch statements, predicting the output before you run each one, including one where default is written in the middle. Auto-graded.
See what JavaScript actually does when a case has no break, and why the bug is easy to miss. Read before 2.3.10 Worked Example: switch vs if-else-if.
Write a three-case switch where the first case deliberately has no break, predict the output, then run it and check. Auto-graded.
This code should print exactly one line but prints two. Find the missing break and fix it. Auto-graded.
Learn how to stack case labels with no code between them so several values share one block. Read before 2.3.15 Worked Example: Weekend or Weekday.
Write a switch with grouped cases that prints Vowel for a, e, i, o, u and Consonant for anything else. Auto-graded.
See why a case can silently never match when the switched value is the wrong type. Read before 2.3.19 case false vs case 0: Predict, Then Run.
Write a switch with case false, case 0, and case '0', then predict which one a number, a boolean, and a string each match. Auto-graded.
This code should print Second place and prints No medal instead. Fix it without changing the case values. Auto-graded.
Learn the one question that tells you which statement fits a problem. Read before 2.3.24 Worked Example: When switch Fits: Command Dispatch.
Rewrite an if/else-if chain that checks a traffic light color as an equivalent switch statement. Auto-graded.
Explain which statement fits a given problem and why. AI-graded.
Write a switch with at least four cases and a default that prices a drink by size. Auto-graded.
Rewrite an if/else-if chain as a switch statement with at least two cases, a default, and break. Auto-graded.
Write a switch on filamentType with at least four cases and a default, printing a recommended temperature and speed for each. Auto-graded.
Stretch problems. Every challenge is required to continue. Auto-graded.
→ View full module pageUnit 2.4 slides: loop control and nested loops.
for and while can do the same job. Learn the test that tells you which one to reach for. Read before Predict: Which Loop Fits?
Write a for loop for a known-count task and a while loop for an unknown-count task. Auto-graded.
while and do...while test their condition at different ends, and that changes whether the body ever runs at all. Read before Predict: while vs do...while.
Turn plain-English steps into pseudocode for a do...while loop: the body runs first, and the question comes after it.
Write a do...while loop that prints 1 through 5, then a second one whose condition starts false and still runs once. Auto-graded.
break ends a loop the moment you tell it to, even if the loop's own condition never becomes false. Read before Searching Without a Known End.
Turn plain-English steps into pseudocode for a search that has no limit of its own: the question inside the loop is the only way out, and the early exit is its own step.
Count up from 1 and break as soon as the square of the count exceeds 50. Auto-graded.
continue is gentler than break: it skips only the current round and keeps the loop running. Read before Filtering While You Loop.
Turn plain-English steps into pseudocode for a loop that skips the even numbers: continue ends one round early but stays in the loop.
In a for loop, continue still runs the increment. In a while loop it can jump straight past your update line, and hang the program. Read before The continue Trap, and Its Fix.
Loop over 1 to 20 and print only the multiples of 3, using continue to skip the rest. Auto-graded.
An infinite loop never crashes and never errors: it just never finishes. Learn the three usual reasons before you have to debug one. Read before Making an Infinite Loop Safe.
A countdown plan arrives whose loop never says when it stops. Find the missing way out and add it, so the plan can finally reach its end.
Five loop programs are broken: two never stop, two are off by one, one has a do...while logic error. Fix all five and explain each bug in a comment. Auto-graded.
A loop inside a loop is a nested loop, and the inner one runs all the way through for every single round of the outer one. Read before A Multiplication Table.
Turn plain-English steps into pseudocode for a row/col nested loop: the inner loop starts over for every round of the outer loop.
Two nested loops over 1,000 items each is a million rounds. Learn to count the cost before you look anywhere else for a slowdown. Read before Triangle of Stars.
Use a nested loop to print a triangle of stars, one row at a time, where the inner loop's limit depends on the outer loop's counter. Auto-graded.
A nested loop is supposed to print each pair once but prints every pair twice, including pairs of a number with itself. Fix the inner loop's starting value. Auto-graded.
Write a nested-loop program that prints a grid of at least 5x5, with the dimensions controlled by variables, not hardcoded loop bounds. Auto-graded.
Stretch problems. Every challenge is required to continue. Auto-graded.
→ View full module pageUnit 2.5 slides: handling errors with try/catch.
See what a runtime error does to a running program, and tell it apart from a syntax error. Read before 2.5.3 Runtime or Syntax?.
Write code that fails at runtime, not at parse time, and confirm which lines still run. Auto-graded.
Learn how try...catch lets a program recover from a runtime error instead of stopping cold. Read before 2.5.5 Worked Example, Only Wrap What Can Fail.
Rewrite a try that wraps too much so the total still prints even when the risky line fails. Auto-graded.
Turn plain-English steps into pseudocode for try/catch: attempt a risky step, run the catch only if it fails, then carry on either way.
Write a try...catch that falls back gracefully when a variable doesn't exist, and confirm the program still finishes. Auto-graded.
Build a try...catch and predict exactly which of four lines print. Auto-graded.
See why a catch block that does nothing is worse than no try...catch at all. Read before 2.5.11 Fix the Silent Catch.
An empty catch block is hiding a failure. Add a report so the next person can see it. Auto-graded.
Read err.name and err.message to say exactly what went wrong. Read before 2.5.13 Worked Example: Reporting Instead of Guessing.
Cause a TypeError on purpose and print both err.name and err.message. Auto-graded.
Raise your own error with throw when a value breaks the program's rules, not the language's. Read before 2.5.16 Worked Example: Validate, Then Trust.
Turn plain-English steps into pseudocode for two validation checks in a row, each one throwing when the input is bad, with the real work only after both pass.
Decide when a problem deserves a throw and when a plain if is simpler. Read before 2.5.19 Reject the Bad Input.
Throw an error when a password is too short, and catch it with a clear message. Auto-graded.
Build a try block where a throw sits between two other lines, and confirm exactly which lines run. Auto-graded.
Run cleanup code whether try succeeded or failed. Read before 2.5.22 When Does finally Run?.
Build a try/catch/finally and confirm finally runs in both the success and the failure case. Auto-graded.
Two limits worth knowing: try...catch can't save a syntax error, and it only guards code that runs inside it. Read before 2.5.24 Guard Only What's Inside.
Write two risky lines: one guarded by try...catch, one left outside it, and see which one crashes. Auto-graded.
Predict the output of a try/catch/finally with a throw inside it, then build it and check. Auto-graded.
Loop over three raw readings and use try/catch to reject bad input with a friendly message instead of crashing. Auto-graded.
Stretch problems. Every challenge is required to continue. Auto-graded.
→ View full module pagePick one of four problems with your partner and write the plan for it in pseudocode: the loop that walks the input, the skip or the stop the problem forces, a three-way classification and a guard against bad input. The build lesson does not open until this one does.
Turn the chart you just passed into a documented, loop-driven program. Eight checks, all of them things Chapter 2 taught. AI-graded: press Grade up to three times and your best counts. After your third try you can see how it is solved, once your teacher releases it.
The writeup that goes with the live demo: who did what, three test cases, and where all five of Chapter 2's sections show up in your program. AI-graded with hints.
→ View full module pageEight questions: three on the ideas of Chapter 2, five where you read a short program and say what it prints. Three tries: you see your total after each one, your best try counts, and the marking appears after the last.
Three short-answer questions. Explain the ideas in your own words. AI-graded: submit, read the feedback and revise. Three tries, and your best counts.
Four bugs in one program. Run it, read what happens, fix each one, and name what kind of bug it was. Fixed, the program runs top to bottom and prints a correct receipt.
Pick one of three problems and write the plan for it in pseudocode: the loop, the value you work out, and the comparison that reports one of three outcomes. No JavaScript needed. Three tries; the AI marks whether the plan answers the problem you picked, and your best try counts.
One problem, pick one of three, write the JavaScript it describes: a nested loop, a branch, a break or continue, a guard. Three attempts, no Run button.
→ View full module pageUnit 3.1 slides: calling a function, defining one, hoisting, and why functions make programs shorter and easier to change.
Understand how to define a function with function name() {} and call it. Defining a function is not the same as running it.
Spot which lines are function calls and count how many run. Checked instantly.
Trace what JavaScript actually does when it reads a function definition versus when it runs a call — and why a call written above its definition still works.
Take a broken function header — missing parentheses, wrong-case name — and fix both problems. Auto-graded.
Three reasons to write functions at all: modularity, reusability, maintainability.
Watch the same three distance calculations shrink from nine lines to three once the math moves into one function.
Write a parameterless function, concessions(), that prints the food and drink options at a cinema, then call it. Auto-graded.
Write terms(), a parameterless function that asks the user to accept terms and conditions, then call it once per user in a loop. Auto-graded.
The starter prints a repeated header three times. Rewrite it so the header lives in one function, called three times, with the output unchanged. Auto-graded.
A new shape arrives: the double-rail rectangle stands for a whole sequence defined somewhere else, and flow comes back from it.
Plan the grade-advisor refactor in pseudocode before you touch the code: name the two functions, say what each one does, and write the main program as calls to them. The gate for 3.1.13: plan first, refactor second.
Take your grade-advisor program from 2.1.42 and break it into two named, parameterless functions: decideGrade() and printAdvice(). Auto-graded.
Write the grade-advisor program you just refactored as pseudocode: set up the three values, call decideGrade(), call printAdvice(), and notice the main program has no decision left in it.
Eight multiple-choice questions on identifying calls, defining functions, hoisting, naming, and benefits. Checked instantly.
→ View full module pageUnit 3.2 slides: parameters and arguments, return values, print versus return, composing functions, and scope. Shown from a copy of the bookSHelf deck kept in this site.
Parameters let you pass inputs into a function, so the same function can give a different result each time you call it.
A function with a parameter leaves a blank for the caller to fill, so one definition can produce a different result every time you call it.
These two words are used interchangeably in conversation but mean different things precisely: a parameter lives in the definition, an argument is passed at the call.
Write a one-parameter function, shout, that prints its word in capital letters, then call it with two different words. Practice, not graded: the checks call your function.
A function matches arguments to parameters by position, not by name, so swapping two arguments changes the answer without raising an error.
Write greet(name) so that calling it with no argument greets "friend", using a default parameter, and calling it with a name greets that name. Practice, not graded: the checks call your function.
Define findRectangleArea(width, height) that works out the area and prints it, then call it twice. Auto-graded.
Turn plain-English steps into pseudocode for a program that passes base into showPriceWithTax(price), then decides Over budget or Within budget from the same base.
return ends a function and hands a value back to the caller, so the call becomes an expression you can store, print, or use in arithmetic.
Write square(n) so that it hands back n times n with return, and use the value it gives back. The first return practice. Practice, not graded: the checks call your function.
return does two jobs at once: it hands back a value and stops the function right there, so anything after it does not run.
Write a function whose first check returns early when the input is invalid, so the valid path runs without an else. Auto-graded.
console.log shows a value to a human; return gives it to the program. A function that prints produces undefined, which is why its result is unusable.
A function computes correctly but prints its result, so the caller gets undefined. Fix it to return, and prove the fix with arithmetic. Auto-graded.
Write initials(first, last) so that it returns the first letter of each name joined into one string, using first[0]. Practice, not graded: the checks call your function.
Because a call to a returning function is itself a value, calls can be fed straight into other calls, which is how small functions build up to big programs.
Turn five plain-English steps into pseudocode for two nested calls: double(5) first, addTen on what it hands back, then a Big/Small decision on the result.
Write two returning functions, triple and addSeven, then feed one result into the other in both orders and log the chains. Auto-graded.
A variable declared inside a function is local: it only exists while that function runs and is invisible outside it. Global variables are accessible everywhere.
Write a global and a local variable, then try to read the local one outside its function and watch the ReferenceError. Auto-graded.
Define two functions, findMax(a, b) and isEven(n), that take parameters and return a value. Auto-graded.
Write largest(a, b, c) so that it returns the biggest of three numbers, whatever order they come in. Practice, not graded: the checks call your function.
Define sumToN(n) that uses a for loop to add every integer from 1 to n and returns the total. Auto-graded.
Ten multiple-choice questions on parameters, arguments, return, scope, early return, and why printing is not returning. Checked instantly.
→ View full module pageUnit 3.3 slides: arrays, indexes, push and pop, looping over an array, and nested arrays. Shown from a copy of the bookSHelf deck kept in this site.
Learn how arrays store ordered lists, how zero-based indexing works, and how push, pop, and length let you grow and shrink the list. Read before the array exercises.
Learn how assigning to arr[i] replaces one item without changing the array's length. Read before the index-assignment lab.
Reassign values inside an array by their index to update scores in place. Auto-graded: the code runs and the final scores are checked.
Learn two ways to visit every item in an array: a plain for loop using the index, and the cleaner for...of loop. Read before the array iteration exercises.
A loop that should print every price also prints an extra undefined. Find the part of the loop that lets it run one round too long and fix it. Practice, not graded: the checks call your function.
Learn .unshift() and .shift(), the front-of-list partners to .push() and .pop() you already know. Read before the queue lab.
Use push and shift to move people through a queue, first in first out. Auto-graded: the code runs and the final line and the person served are checked.
Write rotate(items): the first item goes to the back of the array and the function returns the array. Practice with shift and push, not graded: the checks call your function.
Learn how .split() turns one big string into an array of lines: the usual first step when text arrives as one long string. Read before the exercises that process lines of text.
Write countWords(text): split a sentence at its spaces and return how many words there are. Practice with split and length, not graded: the checks call your function.
Use a for loop to add up all numbers in an array, then log the total. Auto-graded: the code runs and the total is checked.
Turn plain-English steps into pseudocode for a loop over an array with a check inside it: start the counter, look at each price, add one when it is under 10, and print once at the end.
Learn how a whole array can be one function parameter, and how a function can build and return a new array. Read before the filter-function lab.
Write lastItem(items): read the last item of an array parameter and return it, leaving the array exactly as it was. Practice, not graded: the checks call your function.
Write smallest(numbers): find the smallest number in an array, starting your running answer from the array's own first item. Practice, not graded: the checks call your function.
Write a function that builds and returns a new array of transformed values (for example, each number doubled with result.push(n * 2), as in 3.3.15), proving the original is untouched. Auto-graded.
Learn how an array can hold other arrays, which is how you store a grid or a table of rows. Read before the nested-array lab.
Read and reassign values in a nested array with double-index syntax, then sum every cell with a nested loop. Auto-graded: the code runs and the final grid and total are checked.
Eight multiple-choice questions on arrays: changing items by index, loops and the off-by-one, push, pop, shift and unshift, split, arrays and functions, and nested arrays. Checked instantly.
Work with lists of values: create, add, remove, and iterate.
→ View full module pageUnit 3.4 slides: functions as values, function expressions, arrow functions and their shorthand rules, callbacks, and hoisting.
A function can be stored in a variable, copied, and passed around like a number or a string. Read before the function-expression exercises.
When a function is a value, you can write it directly on the right of an equals sign. Meet the function expression and how it differs from a declaration.
Take a named function declaration and rewrite it as a function expression assigned to a const, then call it. Auto-graded.
Arrow functions are a shorter way to write a function expression. Learn the (parameters) => result shape and see one function in all three forms.
The four optional shortenings of an arrow function, including the implicit return and the classic braces mistake that produces undefined.
Turn four plain-English steps into pseudocode for applyTwice: read the operation and the value, make the first call, make the second call on its result, and print.
Write three one-line arrow functions using implicit return, and call each one. Auto-graded.
Because a function is a value, it can be an argument. Learn what a callback is and why passing one separates the loop from the rule.
Write a helper that takes a callback, then pass it a one-line arrow. Auto-graded.
A declaration is hoisted and can be called from above its line; an expression or arrow cannot. Learn the one real difference and when to choose each.
Turn the rule for choosing a function form into pseudocode: is it a main operation called from several places, and if not, is its body a single expression?
Convert three function declarations into one-line arrow expressions and confirm each still behaves the same. Auto-graded.
A two-parameter arrow function was written without the parentheses around its parameters, so the line will not parse. Fix it. Auto-graded.
Write a counting helper that takes a callback, then use it with a one-line arrow to count matching values in an array. Auto-graded.
Turn one operation, adding two numbers, into pseudocode that walks through all three function forms: is it named, is it written with =>, and one print that shows all three results.
Write a function with a parameter and a return value, a second function of your own, and an arrow function, then call them and print the results. Auto-graded.
Eight multiple-choice questions on function values, expressions, arrow shorthand, callbacks, and hoisting. Checked instantly.
→ View full module pageUnit 3.5 slides: objects and properties, dot versus bracket access, nested objects, arrays of objects, methods, and destructuring.
Why an object exists: several facts about one thing, grouped under a single name with key: value pairs.
Read a property with a dot, change or add one by assignment, remove one with delete, and know why a missing property is undefined, not an error.
Build one object, read a field with a dot, change a field, add a new field, and print the object. Auto-graded.
When dot notation cannot work: keys with spaces, and keys held in a variable. Square brackets evaluate the name first.
Read a key with a space and a key held in a variable, and print every key/value pair with Object.keys. Auto-graded.
A property's value can be another object or an array. Read a nested chain left to right, and see the array-of-objects shape.
Turn a loop that reads a nested price from each item into pseudocode, then read the customer's name and ask the VIP question once, after the loop.
Build an object with a nested object and an array of objects, then read values out of it. Auto-graded.
A method is a property whose value is a function, called with parentheses. See why word.toUpperCase needs () but word.length does not.
Give an object a method, call it, and print its return value. Auto-graded.
Pass one options object instead of several positional arguments, so every value carries its name to the call site and order cannot swap it.
Take a function with three positional parameters and rewrite it to read one options object instead. Auto-graded.
Unpack properties into variables in one statement. Objects match by name, arrays match by position.
Turn four plain-English steps into pseudocode for describeBox(): unpack width, height and color from options in one step, build the note, add "(wide)" only when width is greater than height, then give the note back.
Unpack three fields in one statement, use the bare names, and rewrite a function to destructure its parameter. Auto-graded.
Refactor three parallel arrays into one array of records, then read the fields back with a dot. Auto-graded.
Build an array of records, read fields with dots and brackets, and destructure a record into variables. Auto-graded.
Eight multiple-choice questions on object literals, dot vs bracket access, nesting, methods, and options objects. Checked instantly.
→ View full module pageUnit 3.6 slides: what a function receives, mutating versus reassigning, side effects, and working on a copy.
Primitives (numbers, strings, booleans) are copied when passed to a function: the original is safe. Objects and arrays are shared: a function can change the original.
Write one function that reassigns a number parameter and one that mutates an array parameter, then log the caller's variables to prove which change escaped. Auto-graded.
Mutating an object changes what it holds; reassigning a name points it somewhere else. Only one of those reaches the caller.
Turn plain-English steps into pseudocode for process(nums): one write mutates the shared array and the caller sees it, the other reassigns the local name and the caller does not.
A function is supposed to update the caller's array but reassigns its parameter instead, so nothing changes. Fix the body so the update reaches the caller. Auto-graded.
A side effect is a change that outlives the call. Make it the whole job or work on a copy so the caller's data survives.
Protect the original by copying before you change: spread [...arr] makes a new array so mutations stay in your copy.
Mutate a property on an object parameter and prove the caller sees it, then write a non-mutating version that keeps the original untouched. Auto-graded.
Show that a spread copy is only one level deep: change a nested array inside the copy and the original still changes. Then fix it with a deep copy. Auto-graded.
Explain pass by value and pass by reference in your own words, give one example of each, and describe a bug that could happen if you forget the difference.
Build a small scorebook that adds scores without harming the caller's array, and a function that updates an object's property the caller can see. Auto-graded.
Eight multiple-choice questions on primitives vs objects, mutation vs reassignment, side effects, and defensive copying. Checked instantly.
→ View full module pageUnit 3.7 slides: map, slice, concat, the spread operator, and copying an object with changes.
Learn how .map() builds a new array by calling your callback once per element, and why the original list is never changed. Read before the .map() lab.
Use .map() to build a transformed copy of an array, then demonstrate the original is unchanged. Auto-graded.
Turn four plain-English steps into pseudocode for what .map() does: a loop you did not write, one result per item, collected in a new list.
Learn how .slice(start, end) copies part of an array, why the end index is excluded, and why the original is never changed. Read before the .slice() lab.
Create an array, copy a middle range and a run to the end with .slice(), then show the original is unchanged. Auto-graded.
Learn how .concat() returns a new array with another array's items added on the end, leaving both originals untouched. Read before the .concat() lab.
Join two arrays into a new one with .concat(), then show both originals are unchanged. Auto-graded.
Learn how the spread operator ... unpacks an array into separate arguments, and how the same three dots mean the opposite in a function definition. Read before the spread-call example.
Learn how spread copies contents into a new array or object literal, and how { ...obj, field } makes a copy with one value changed. Read before the spread labs.
Turn four plain-English steps into pseudocode for the body of total(...numbers): the same gathering loop whether the caller spreads an array or lists the numbers.
Use spread to combine two arrays and to add loose values around a copied one, without changing any input. Auto-graded.
Use object spread to copy an object with one property overridden and one property added, leaving the original untouched. Auto-graded.
Meet the array methods this book does not teach but other people's code uses: filter, forEach, reduce, indexOf, includes, sort, reverse, and every. Read to recognize them.
Demonstrate one method that changes its array and one that returns a new array, logging before and after each. Auto-graded.
Combine the module's non-mutating tools: build a list, transform it with .map(), take a range with .slice(), join with .concat() or spread, and copy an object with an override. Auto-graded.
Eight multiple-choice questions on .map(), .slice(), .concat(), spread, rest, and mutating versus non-mutating methods. Checked instantly.
→ View full module pageUnit 3.8 slides: JSON, JSON.stringify and JSON.parse, parsing that can fail, and saving by key in storage.
See why a value that only lives in memory is gone the moment the tab closes, and why everything that stores data stores text. Read before the stringify reading.
Learn how JSON.stringify turns an object or array into a single string with every property intact, and what changes from a JavaScript literal. Read before the stringify lab.
See how the second and third arguments to JSON.stringify turn compact text into indented, human-readable output, and when to use each form.
Learn what JSON silently drops — functions and undefined values — and why that is JSON storing data rather than behaviour, not a bug.
Build an object that has a method and an undefined property, stringify it, and find out in the output what JSON refused to carry. Auto-graded.
Learn how JSON.parse turns a JSON string back into a real value whose numbers add and whose arrays have a length. Read before the round-trip labs.
Save an object to JSON text, restore it with JSON.parse, and prove the restored copy is independent of the original. Auto-graded.
Round-trip a game-state shape — an object holding an array of item objects — through stringify and parse, then read a nested field back. Auto-graded.
Learn that JSON.parse throws a SyntaxError on malformed text, and why text you loaded is text you did not write so the call belongs in a try...catch.
Write a function that parses text and returns a usable fallback instead of letting a bad string stop the program. Auto-graded.
Learn how localStorage saves a string under a name you choose, why everything comes back as a string, and why a never-saved key gives null. Read before the save/load labs.
Turn four plain-English steps into pseudocode for loadSettings(): read the key, check for nothing stored, then parse inside a try, with the defaults as the fallback on both exits.
Turn a state object into JSON text and store it under a key, the way a page would keep it between visits. Auto-graded.
Read a saved key, cope with a never-saved key, and parse the stored text back into a usable object with a fallback. Auto-graded.
Learn why a browser page gets no filesystem access at all, and why reading a local file requires the user to pick it. Read to close out the module before the sandbox example.
Combine the whole module: save a state object by key, load it back with the missing-key and bad-parse guards, and print the restored values. Auto-graded.
Apply the save/load pattern to an array of records rather than a single object, and read one record's field back out. Auto-graded.
Nine multiple-choice questions on JSON.stringify, JSON.parse, what does not survive a round trip, parse failures, saving by key with localStorage, and the browser sandbox. Checked instantly.
→ View full module pagePick one of four problems with your partner, then repair the plan: it is already written, and four lines in it are wrong — the wrong function for a job, calls missing something they need, and a report in the wrong place. The build lesson does not open until this one is done.
Part 2 of 3, worth 50%. Turn the plan you just wrote into documented functions and a short main section that uses all eight Chapter 3 sections. Grade up to three times; your best try counts, and each partner has their own three. After your third try you can see how it is solved, once your teacher releases it.
Part 3 of 3, worth 25%. A short write-up with your partner: who did what, three test cases, one thing you logged, and three Chapter 3 sections found in your code. Grade up to three times; your best try counts.
→ View full module pageEight questions: three on the ideas of Chapter 3, five where you read a short program and say what it prints. Three tries: you see your total after each one, your best try counts, and the marking appears after the last.
Part 2 of 4, 20 points. Four broken programs. Identify each bug, name its type (syntax / runtime / logic), and fix it. Three tries, feedback on each bug, and your best try counts.
Part 3 of 4, 30 points. One problem, pick one of three, write the JavaScript it describes: functions with parameters and returns, an array of records, map, spread, and a save/load round trip. Three tries with feedback on each criterion; no Run button.
Part 4 of 4, 10 points. A short write-up about the program you wrote in Part 3: three test cases, one thing you logged, and three Chapter 3 sections found in your code. Three tries; your best try counts.
→ View full module pageQ1 Synthesis Project slides. Placeholder until the deck is built from the book.
Write the steps as comments first, then fill in the code underneath. Read before the Q1 Synthesis Project.
The last two shapes, for the first chart too big to fit on a page: a jump that replaces a long arrow, and a note for the reader.
Call a function with a known input and print PASS or FAIL based on whether the result matches what you expected. Read before the Q1 Synthesis Project.
Design day: plan the whole program as numbered pseudocode before any build time. One CALL per planned function, under twenty steps. The build lessons open when this is green.
Q1 synthesis: build a program that meets a checklist of requirements. Arrays of objects, functions, sorting, save/load, and your own tests — the rest is your call.
Reflect on your first quarter of programming and connect your experience to the SDLC. AI-graded with hints.
→ View full module pageAn overview of this module: the canvas, sprites, keyboard input, and the frame loop that runs your code about 60 times a second.
A 2-and-a-half-minute walkthrough of the canvas, a sprite, and the Run button. Watch before the Hello Sprite lesson.
How moSHion calls setup() once and draw() every frame. Read before 5.1.4 (Worked Example: Minimum Sprite Program).
How new Canvas(w, h) opens the drawing area and why (0, 0) is top-left with y increasing downward. Read before 5.1.6 (Sprite).
How new Sprite(x, y, w, h) creates a rectangle the engine renders for you, and how .color sets its fill. Read before 5.1.7 (lab).
Change one number at a time in a sketch that already works, predict what will move, rerun, and check. Practice from 5.1.5 and 5.1.6. No new code to write.
Why you declare a let at file scope and assign the sprite in setup(), and what goes wrong when you create sprites inside draw(). Read before 5.1.9.
Why background(color) must be the first call inside draw() to clear the previous frame, and what motion trails look like without it. Read before 5.1.10.
How to read and write the core sprite properties pos, rotation, and layer after the sprite is created. Read before 5.1.11 (Hello Sprite).
Your first moSHion sketch: a canvas, a sprite, a background color.
A 2-and-a-half-minute walkthrough of the frame loop: setup() runs once, draw() runs about 60 times a second, and a sprite moves because draw() changes its x a little each frame. Watch after Hello Sprite.
How kb.pressing(key) checks whether a key is held this frame. Read before 5.1.14 (Key names: WASD and the arrow keys).
The name you give kb.pressing() picks the key: single letters for WASD, words for the arrow keys. Either set works. Read before 5.1.15.
How sprite.vel.x and vel.y work as pixels-per-frame values the engine integrates into position, and how moving by vel differs from changing pos yourself. Read after 5.1.14.
The canonical if/else-if/else pattern that maps key presses to velocity changes inside draw(). Read after 5.1.15.
Why velocity persists across frames and why the else branch is what stops the sprite. Read after 5.1.16.
Teacher-led walkthrough of the if/else-if/else pattern for keyboard movement and the drift-bug. Read before Make it Move.
Start from a working WASD movement pattern, delete the two else lines and watch the sprite drift, then restore them and set a speed of your own.
Drive a sprite with the keyboard by setting vel.x and vel.y from the keys that are held. Use WASD or the arrow keys, your choice.
How text(words, x, y) puts words on the canvas, what fill() and textSize() change, and why text goes after background(). Read before 5.1.23.
frameCount counts the frames, sin() turns that count into a smooth back-and-forth wave, and together they make a sprite move with no key held. Read before 5.1.23.
Build a sprite playground combining canvas, a keyboard-controlled sprite (WASD or arrow keys), auto-motion, and on-screen text. Auto-graded.
Written reflection on setup/draw and the 60fps math. AI-graded with hints.
Pick one or more of the stretch challenges and implement them in the editor. Auto-graded.
Optional: a preview of an optional mode. Draw a grid over the canvas, then switch it to math mode, where (0, 0) is the centre and y grows up. Nothing after this lab needs it, and it is not graded.
→ View full module pagerandom(6) gives a decimal, floor makes it whole, and frameCount with % makes a beat. A 3-minute walkthrough of the next reading.
random(max) and random(min, max), floor for whole numbers, and timers made of frames: a repeating beat, a one-shot, and the mistake that stops a one-shot from ever running.
A square appears at a random spot, in a random colour, every 30 frames, and a message arrives once at frame 300. Change the numbers and watch the beat and the moment move.
Once a second, move a coin to a random place, roll a whole-number die, and give the coin a random colour from a list.
Blink a lamp every 30 frames, show a message once at frame 300, and repair a halfway check that sits inside another condition and never runs.
Module 5.2 opener: dynamic and static sprites, gravity, the ground-gated jump, bounciness and friction, reaching a goal, and the Pinball Scene you will build.
Why nothing fell in 5.1: world.gravity.y, and dynamic versus static sprites. A 2-and-a-half-minute walkthrough of the next reading.
world.gravity.y and dynamic vs static sprites. Read before 5.2.10 Lab: Tune Gravity.
A dynamic block falls under gravity and lands on the static ground. Read the example, then experiment. Follows 5.2.8 (Reading: Gravity).
Try different world.gravity.y values on the same scene and describe how each one feels. Change the value, then write one sentence per value as a comment.
kb.presses versus kb.pressing, colliding(ground), and the two bugs a jump can have. A 2-minute walkthrough of the next reading.
colliding() and edge-triggered kb.presses vs level-triggered kb.pressing. Read before 5.2.13 Lab: Add a Jump.
Gate a jump on a key press and a ground check. Auto-graded.
Bounciness from 0 to 1, friction as a slide distance, and how two sprites combine them. A 3-minute walkthrough of the next reading.
The two properties and the combining rule. Read before 5.2.16 Bouncy Ball.
Learn how bounciness and friction change how sprites feel.
Setting .vel overwrites motion, applyForce adds to it, and mass changes how far a force moves a sprite. A 2-and-a-half-minute walkthrough of the next reading.
applyForce vs setting .vel directly. Read before 5.2.19 Lab: Wind Zone.
Push the player with applyForce inside a conditional zone. Auto-graded.
a.delete() versus b.visible = false: what stops, what keeps running, and when to use which. A 2-minute walkthrough of the next reading.
delete() vs .visible. Read before 5.2.22 Worked Example: The Finished Scene.
Use the finished scene's distance check to win once with delete(). Auto-graded.
Build a pinball-style scene: static obstacles, a bouncy ball, gravity, and a reset key. Run plays it; the Check button has the AI mark the Quest cards.
Why setting .vel every frame fights the physics engine, and when applyForce is the better tool. AI-graded with hints.
Add a second, harder-to-reach goal and track a two-goal completion count. Auto-graded.
The frame order: update, physics, draw, paint, and why a velocity set in update() moves the sprite this frame. A 2-and-a-half-minute walkthrough of the next reading.
moSHion runs a third function on every frame, update(), before the physics step moves the sprites; draw() runs after it. So the rules of the game (keys, movement, the jump) can go in update(), and the picture (background, words) stays in draw(). Read before 5.2.29 Lab: Rules in update(), picture in draw().
The jump scene from 5.2.13 does everything in draw(). Split it in two: move the keys, the movement and the jump into update(), which moSHion runs before the physics step, and leave draw() with only the picture.
→ View full module pagePlay the one-player pinball table you will build, with a launcher, two flippers, and a drain. See where each piece fits in the course.
Build the square practice table one stage at a time. In 5.5.5 you’ll turn it into the taller arcade cabinet you played in the opening lesson.
Before any code: list the parts of your pinball game, what it must remember, what to build first and what looks hard. AI-graded with hints.
The scene you built in 5.2.24 is not yet a game. Names the four things that turn one into the other — a goal, a score, a way to lose, a way to start again — and shows the scene with none of them.
Names the table's sprites, adds a gold goal bar on the ball's path, then shows the score that jumps by 33 when the ball rolls across it once — deliberately, because 5.4.1 explains why.
Turn gravity on and drop a bouncy ball. It has nothing to land on yet; the next lab builds the walls and the ground.
Build two walls and a ground with a gap for the ball to drain through. Your ball from the last lab carries forward.
Put a tilted bumper under the ball so it rolls to the right. Your walls and ground carry forward.
Put a gold goal where the ball really goes. The score is drawn but does not change yet — counting is the next lesson. Your table carries forward.
→ View full module pagecolliding() is level-triggered: it is true on every frame two sprites touch. Shows why a score written on a collision climbs sixty times a second, and the three-line pattern that turns a frame into an event.
The same table counted two ways: once per frame, where the score races into the hundreds, and once per touch with a remembered last frame. Ends by showing the pattern belongs to any lasting condition, not just collisions.
One ball, one bumper, one score. Build the smallest thing that scores once per hit, before you put the same idea into your table.
The starter scores on every frame the ball touches the goal, so one roll across the gold is worth 33 points. Fix it with a remembered last frame, so one touch is worth one point.
Three bumpers, worth 1, 5 and 10. The starter scores only the first, on every frame. Loop over all of them and let each bumper remember its own last frame, so every bumper scores once per hit and for its own value.
→ View full module pageA round is either playing or over, and one flag holds which. Shows the losing condition as a position test, how draw() branches on the flag, and everything a restart has to put back — including the ball's velocity.
A ball falls into a pit, the round ends after three seconds, and R starts it again. Build the smallest version of losing, before you put it into your table.
Give the game an end: a flag for playing or over, a losing condition when the ball falls past the bottom, and a restart that puts the score back as well as the ball.
Two planted bugs. The ball falls into the pit, the word Game over appears, and the ball keeps falling anyway. Find both.
Play the one-player table and trace how a launch key and two flipper keys change what the physics bodies do.
Turn your scoring table into a game you can steer. Tap Space to launch and use Z and M to keep the ball from draining.
Play your game at least three times, find one thing that surprised you, link it to your code and choose one change. AI-graded with hints.
→ View full module pageloadSound() downloads a sound once, in setup(); .play() plays one copy and .volume sets how loud. The chime goes where the score goes, inside the edge check, so a hit gives one ding and not a buzz. Most browsers stay silent until the first click or key press on the game. Read before 5.6.3 Lab: A chime on every bumper hit.
A key press plays one sound. Load it once, play it where the event happens, and hear the difference between once and every frame.
Add a chime to the playable table from 5.5.6. Load it once and play it only when a new hit scores.
Two planted bugs. Press Space once and the sound stutters; then it stops working after a reload. Find both.
→ View full module pageA sprite can wear its own words with .text, coloured by .textColor and sized by .textSize; they move with it and stay upright. .life = 60 deletes a sprite about one second later, which is why life was on 5.4.5's list of names not to use. A sprite made on one frame only, such as the frame a hit starts, is fine in draw(). Read before 5.7.2 Worked Example: A "+5" that floats away.
A two-bumper table where each bumper wears its worth, and each hit makes one small gold popup that floats up and removes itself with .life. Then the same popup made under if (touching), which piles up into a gold smear: the popup goes where the score goes.
Click and a small word pops up, floats, and removes itself. Build the popup alone, before it goes on a bumper.
Your table from 5.6.3 scores and chimes, but a player cannot see what a bumper is worth or what a hit just gave them. Write each bumper's worth on it, and make a small "+5" pop up on every hit, float away and remove itself.
→ View full module pageFour knobs that belong to one sprite. A heavier body moves less under the same push, but falls at the same speed. gravityScale is a sprite's own share of gravity (0 floats, 0.5 drifts). rotationLock = true stops a body from turning. debug = true draws the collider, the body moSHion really uses, for finding bugs. Read before 5.8.3 Lab: Nudge the table.
The same push on two balls, one heavy and one light. Build it small, then feel the difference before you tune your table.
Pinball players nudge the table to save a ball. Let a held arrow key push the ball with applyForce, choose the ball's mass so that push is a nudge and not a launch, and switch on debug to see the body moSHion uses for the ball.
Two planted bugs. The "heavy" ball shoots away and the light one barely moves. The labels are right; the physics is reversed.
→ View full module pagePlay your polished pinball at least three rounds, and hand it to someone for one if you can. Say what still felt rough, what one polish changed for a player, and what you would polish next. AI-graded with hints.
The game is complete. Change one rule of your own: a second goal worth more, a bumper that slides, or a best score that survives a restart. Pick one, combine them, or invent one.
Your table works and feels better already. Add one more polish of your own: popups that fade instead of vanishing, a tilt rule that punishes shaking the table, or a heavier ball from round 2. Pick one; add an idea of your own on top if you like.
→ View full module pagePlay the finished Flappy game before you build any of it. Names the parts it is made of and the module where each one is built, and says plainly which parts come later.
Before any code: list the parts of a flapping-bird game, what it must remember, what to build first and what looks hard. AI-graded with hints.
A flapping bird is gravity that never stops plus one sudden change to the bird's speed. Shows why the flap sets the speed rather than pushing, and why the key must be an edge.
A bird, gravity and one flap on the space bar, with a ceiling and a floor. Change the two numbers and feel how each one alters the game.
A bird falls. One tap sends it back up. Build that alone, before there are pipes.
The bird falls and nothing lifts it. Add a flap on the space bar that sets the bird's speed, then keep the bird from leaving the screen.
→ View full module pageThe bird never moves sideways. The pipes do. Shows how to build obstacles on a timer, keep them in an array, and remove the ones that have left the screen.
A pipe comes from the right, crosses, and is gone. Then two, then many, and none of them pile up.
The starter builds one pair of pipes and leaves it. Build a new pair on a timer, keep them in an array, and delete the ones that have left the screen.
Two planted bugs. Pipes vanish from the screen and the list grows for ever; then splicing skips every other pipe.
→ View full module pageA pipe crosses the bird. Count it once, however many frames the bird is beside it.
A pipe the bird has flown past is worth a point, once. The starter shows a score that never moves. Give every pipe a flag that remembers it has been counted, the same idea as 5.4.4 with a different trigger.
Touching a pipe ends the round. Reuse the playing flag from 5.5.1: freeze the world when it ends, run the game only while the flag is true, and make the restart clear the pipes as well as the bird and the score.
Play your game at least three times, find one thing that surprised you, link it to your code and choose one change. AI-graded with hints.
Eight multiple-choice questions on gravity and the flap, the scrolling world, timed spawning, removing what has left, scoring a pass once, and what a restart puts back. Checked instantly.
The game is complete. Change one rule of your own: a narrower gap, pipes that speed up with the score, a best score that survives a crash, or a wobbling gap. Pick one; add an idea of your own on top if you like.
→ View full module pagePlay the finished Snake game before you build any of it. Names the parts it is made of and the module where each one is built, and says plainly which parts come later.
Before any code: list the parts of Snake, what the game must remember between frames, what to build first and what looks hard. AI-graded with hints.
Snake lives on a grid of cells, not on free pixels. Shows how a column and a row become a pixel position, and how the game moves one cell every few frames.
One block steps right a cell at a time and wraps around the edge. Change the beat and the cell size to see what each one controls.
A square jumps one cell at a time, on a beat. Build the step before there is a snake.
The block only walks right and walks off the edge. Add the four arrow keys with two direction variables, forbid turning back on yourself, and end the round at a wall.
→ View full module pageThe snake is a list of cells. Shows the trick that makes it move and grow: add a new head, and remove the tail unless the snake just ate.
A head in an array, and a body that follows it. Grow it by one, then eat something.
The snake is a three-cell body that moves as one cell, and the food does nothing. Move it by adding a head and removing the tail, then let eating keep the tail and add a point.
Two planted bugs. The snake moves and leaves no body behind, and when it does grow the tail pops off immediately.
→ View full module pageTwo questions need the snake searched: did the head run into the body, and is this cell free for food? Shows one helper, written once, that answers both.
A body that follows you will eventually meet you. Ask the question every step, before you move.
The snake passes through itself and the food can appear under its body. Write one search helper and use it both to end the round on a bite and to keep the food off the snake.
Two planted bugs. The snake runs over its own body and keeps going. The search is there, but it asks the wrong question.
→ View full module pagePlay your game at least three times, find one thing that surprised you, link it to your code and choose one change. AI-graded with hints.
Six multiple-choice questions on the grid, the beat, steering without turning back, moving and growing with unshift and pop, and searching the snake. Checked instantly.
The game is complete. Change one rule of your own: a snake that speeds up as it eats, a best score that survives a loss, or a fix for the quick double-turn. Pick one; add an idea of your own on top if you like.
→ View full module pageBefore any code: list the parts of Pocket, what the game must remember between frames, what to build first and what looks hard. AI-graded with hints.
Mouse and key input have the same three moments: a press on one frame, a hold on every frame, and a release on one frame.
A ball, a pointer and a line. The smallest possible aim, before there is a table.
Put the aim line on a table with rails, so the line is the shot you are about to take.
→ View full module pageDirection is degrees, speed is pixels a frame, and a pull-back sets both when you let go.
One ball, one pull, one release. Set direction and speed at the moment the button comes up.
The whole shot, in one program: line while held, direction and speed on release, and a speed read-out.
Pull back from the cue ball and let go: the ball crosses the table, and the rails stop it.
→ View full module pageTop-down there is nothing to rub on, so drag does the slowing, and "stopped" is a speed under a number.
One ball, moving, and a rule that calls it stopped. No table, no pockets.
The table, drag, the stop rule, and a shot counter: you can only shoot from rest.
→ View full module pageA sensor asks whether two sprites overlap without pushing them, and the answer is true on many frames.
A hole is a target, not a wall: pass-through, and only a slow ball drops.
A ball, a hole, and the speed test. No table, no rules yet.
The table with a pocket: a slow ball drops, a fast one rolls over, and the game says what happened.
→ View full module pagePlay your Pocket at least three times, find one thing that surprised you, link it to your code and choose one change. AI-graded with hints.
Five multiple-choice questions on the pointer, direction and speed, drag and the stop rule, and a pocket you roll over. Checked instantly.
Three extensions: a second pocket, a sand patch that slows the ball, and a scratch that costs a shot.
→ View full module pageGroups and Overlaps slides: overlap detection, safe despawn, edge-triggered input, and ground-gated jumping. Placeholder until the deck is rebuilt from bookSHelf.
Why a Group is a class with shared defaults, and how a single line creates fifty enemies. Watch before 6.6.5 Groups Sandbox.
moshion docs chapter on Groups. Read before 6.6.5 Groups Sandbox.
Groups let you treat many sprites as one. Create, configure, spawn into, and clean up a Group.
→ View full module pageThe two flavors of overlaps() and why the callback form is cleaner for despawn-on-collide. Watch before 6.7.2 Apple Catcher.
moshion docs chapter on collisions and overlap detection. Read before 6.7.5 Safe Despawn.
Live demo of why for (let i = 0; i < group.length; i++) + .delete() skips items, and how to fix it. Watch before 6.7.5 Safe Despawn.
Combine Groups, overlap detection, and safe despawn into a playable asteroid scene. WASD steers the ship; an overlap with any asteroid ends the game.
Pick one (or more) Groups stretch challenges: add a lives counter to Apple Catcher, vary apple sizes for varied points, or implement a cull() helper. Auto-graded.
Physics Applications slides. Placeholder until the deck is built from the book.
Why holding space launches a super-jump 60 frames in a row, and how the edge-triggered form fixes it. Watch before 6.8.4 Edge-triggered Input.
moshion docs chapter on input: kb.pressing (level-triggered) vs kb.presses (edge-triggered). Read before 6.8.4 Edge-triggered Input.
The infinite-jump bug live, and the colliding(ground) fix. Watch before 6.8.7 Ground Detection.
moshion docs on sprite.colliding(other) and the ground-gated jump idiom. Read before 6.8.7 Ground Detection.
Build a one-sprite platformer: WASD moves, space jumps, but only when touching the ground.
Build a two-wheeled car using HingeJoints and drive it up a ramp with WASD. The harder of the two A14 options.
→ View full module pageAnimated Sprites and Camera slides cover named textures, camera follow, smoothing with lerp, and layer for render order. Placeholder until the deck is rebuilt from bookSHelf.
See a sprite change its visual based on player state. Use the current technique in the worked example and Animated Sprites Sandbox.
moshion docs chapter on Animation. Read before 6.9.9 Animated Sprites Sandbox.
Play an animated sprite sheet by assigning its name to sprite.texture.
Choose a sprite’s active texture with sprite.texture. Read before 6.9.8 (Worked Example).
How sprite.animation.frameDelay = N slows or speeds an animation cycle. Read before 6.9.9 (Animated Sprites Sandbox).
How sprite.image = url displays a still image without any animation cycle. Read before 6.9.9 (Animated Sprites Sandbox).
Use named textures to show the player standing, moving, or jumping based on input, and play the jump once.
Why the camera is a coordinate transform, not a 'real' object: the world stays put, only the viewport moves. Watch before 6.9.16 Worked Example: Camera Follow.
moshion docs chapter on Camera. Read before 6.9.16 Worked Example: Camera Follow.
How assigning camera.x and camera.y shifts the viewport center each frame. Read before 6.9.13 (Camera-follow pattern).
How camera.x = player.pos.x inside draw() locks the viewport onto a moving sprite. Read before 6.9.16 (Worked Example: Camera Follow).
How lerp(current, target, t) replaces a hard-set camera follow with a smooth elastic trail. Read before 6.9.17 (Worked Example: Smooth Camera).
How sprite.layer = N controls draw order so HUD elements always render on top of world geometry. Read before 6.9.18 (A15.1 Platformer).
Combine animated sprites, a camera that follows the player, three or more platforms, working jump mechanics, and a visible end goal into a playable side-scroller. Auto-graded.
Pick one (or more) Animation & Camera stretches: parallax background, mirror the sprite when it walks left, or add vertical camera follow. Auto-graded.
→ View full module pageSave and Load opening slides: why game data disappears on refresh, what persistence means, and the plan for building a save/load system your players can count on. Placeholder until the deck is rebuilt from bookSHelf.
A game resets to zero on refresh. Variables live in RAM: gone when the tab closes. Saved data lives on disk, still there tomorrow. This short video contrasts both so you understand what persistence actually means.
How storeItem(key, value) writes a value into the browser's save slot so it survives page reloads. Your game can remember things between sessions.
Step-by-step: build a survival game, detect when the game ends, and use storeItem to save the player's high score so it survives a reload.
How getItem(key) reads back a value your game saved earlier, as the same type you saved. What to do when nothing was saved yet, and when you still get text, is in 6.10.6.
A number you saved with storeItem comes back a number, unlike 3.8's localStorage. Text you saved comes back text: here's when Number() still matters, and the || 0 fallback for the first run.
Read your saved high score on startup, coerce it with Number(), display it next to the current score, and update it when the player beats their record.
A high score is one number. But your game has position, level, inventory: many pieces. JSON bundles them together.
JSON.stringify takes a JS object and turns it into a string you can store. Think of it as packing your game state into a box.
JSON.parse unpacks a JSON string back into a JS object. It's the reverse of JSON.stringify.
The full pattern: build a save object, stringify it, store it. Then getItem, parse, and restore. Complete round-trip.
Build a game with a moving player, score, and level. Save everything as one JSON object with storeItem.
Load a saved game: getItem, JSON.parse, coerce numbers, then apply to your game objects.
loadJSON loads external JSON files (levels, dialogue, config): different from save/load. It's async and needs a callback.
One save isn't enough: games have multiple slots. Each slot is just a different key name passed to storeItem/getItem.
removeItem(key) deletes one save. clearStorage() deletes every save, in every game (saved art is kept). When and how to use each.
Build three save slots. Each slot is a differently-named key. Press 1/2/3 to save, load with a simple text menu.
Manage save slots: delete old saves with removeItem, confirm before overwriting, handle the empty-slot case.
If a save exists, show 'Continue'. If not, only 'New Game'. The title screen pattern every game uses.
Build a title screen that checks for a save on startup. If save exists, show 'Press C to Continue'. Always show 'Press N for New Game'.
No drawing. Read the title-screen save check and answer five questions about what a first-time player sees.
When the player tries to save over an existing slot, show an 'Are you sure?' prompt before writing.
Not every save needs a button press. Auto-save triggers on level transitions, checkpoints, or a timer: the player doesn't think about it.
An auto-save fires when something important happens: reaching a checkpoint, finishing a level, hitting a score milestone.
Implement two auto-save triggers: when the player reaches a level-complete zone, and a timer-based save every 30 seconds.
Graded: build a game with a complete save system, at least 3 save slots, load functionality, auto-save on level complete, and a Continue option on the title screen.
Extend your save system: save file previews (show slot contents before loading), save timestamps, multiple profiles, or deleting this game's saves with double-confirmation.
→ View full module pageGame State Machines opening slides: title screen, gameplay, pause, game over. Every screen is a state. One variable controls which screen is active. Placeholder until the deck is rebuilt from bookSHelf.
Every game has states: title → play → game over → title. A state machine is just a variable that remembers which screen you're on.
switch is like if/else but cleaner when checking one variable against many values. Syntax: switch(variable) { case VALUE: ... break; }
In moSHion games, switch goes inside draw(). Each frame, it checks the state variable and draws the right screen.
A plain switch with three cases that each draw different text. Not a game yet, just getting comfortable with the syntax.
break exits the switch; without it, execution falls through to the next case. default handles unexpected values.
One variable controls which screen is visible. Every frame, draw() checks state to decide what to render. This is the single source of truth for your game's screen.
Build three distinct screens: red, green, blue backgrounds with different text: all controlled by one state variable with switch.
Use lowercase strings for state names: 'title', 'play', 'pause', 'gameover'. Be consistent. Good names make the switch statement self-documenting.
A title screen is just a state. It shows the game name, maybe instructions, and waits for the player to press a key to start playing.
Build a title screen state that shows the game name and 'Press ENTER to start'. When they press Enter, change state to 'play'.
The game over screen shows the final score and 'Press R to restart'. Restart means resetting variables + changing state back to 'play' (or 'title').
The complete beginner state machine: title screen → gameplay → game over → restart. The classic arcade loop.
Turn the plain-English rules of a three-state game into pseudocode: route by state, draw first, then ask whether to change state.
Input-driven transitions happen when the player presses a key. Title → Play (press Enter), Play → Pause (press P). The player is in control.
Build a game where every state transition is triggered by the keyboard: Enter (start), P (pause/unpause), Escape (quit to title).
Condition-driven transitions happen automatically when something in the game changes. Score ≥ 100 → 'win', health ≤ 0 → 'gameover'. The game state triggers it.
Implement condition-driven transitions: score reaches 50 triggers a win screen, health drops to 0 triggers game over. The game decides when states change.
Real games have more than 3 states. Pause freezes the action. Inventory shows items. Settings adjusts volume. All use the same switch pattern you already know.
Add a pause state to your game. When paused, stop movement and physics, show a PAUSED overlay. Press P to toggle pause on and off.
Repair half-finished pseudocode for a pause feature: give the not-playing frame its own branch, wire in the pause screen, stop a step jumping to itself, and add the way out.
A win screen shows when the player reaches the goal. It's a distinct state with congratulations, final stats, and a 'Play Again?' option.
States and saves work together: when the player reaches 'gameover', auto-save their score. When they hit 'win', save their victory. States trigger saves.
Graded: build a game with at least 4 states (title, play, pause, gameover) with full save/load integration. Saves trigger on state transitions. Continue restores the right state.
Extend your state machine: animated transitions, a loading screen state, state history (undo last transition), or an options/settings state that modifies gameplay.
You've built save systems and state machines: real game infrastructure. Unit 3 preview: what comes after the fundamentals.
→ View full module pageAdvanced Input opening slides: the input ideas you need before the capstone: mouse position, click vs. held, dragging, and two-player key schemes. Joints and the slingshot pattern follow in Unit 6.13. Placeholder until the deck is rebuilt from bookSHelf.
This is the last content unit before you design your own game. Mouse input, joints, and the slingshot pattern are the final building blocks: learn them here and you'll have everything you need to pitch and build a real project.
mouse.x and mouse.y give you the cursor's position on the canvas every frame. Read this before the mouse input worked examples.
mouse.pressing() is true every frame the mouse button is held down. Read this before 6.12.5 so you understand the held vs. one-shot difference.
mouse.presses() is true on exactly one frame: the moment the button first goes down. Read this after 6.12.4 to see how one-shot input differs from held input.
A hit-test checks whether the cursor is currently over a sprite. This technique gates click-and-drag: the drag only starts when the mouse is on the sprite.
Clicking is one-shot, but dragging follows the cursor across frames, and physics will fight you if you don't know the trick. This video shows the snap-and-zero-velocity pattern that makes a drag feel smooth before you code it yourself.
How to move a sprite exactly to the cursor position each frame during a drag. Zeroing the velocity is the step that keeps physics from fighting your snap.
Repair half-finished pseudocode for dragging: give the mouse-up frame its own branch, put the velocity reset where it belongs, and stop a step jumping to itself.
One keyboard, two players: WASD on the left, arrow keys on the right, each with their own sprite and score. This video shows the pattern once so you can wire it up in A17.1 without guessing.
Two players on one keyboard means two separate key sets and two separate sets of variables: one for each player. Read this before 6.12.16 Worked Example: Two Paddles, Two Schemes.
sprite.bounciness controls how much energy a sprite keeps after a collision: 0 is a dead thud, 1 is nearly lossless. Read this before 6.12.15 Worked Example: Bounciness Comparison.
Three joint types in five minutes: a distance joint keeps two sprites a fixed length apart, a hinge lets one pivot around another, and a slider rides a track. You don't need to master all three, just watch and pick the one that fits your game.
How DistanceJoint constrains two sprites to stay at a fixed distance from each other. Read this before the pendulum worked example.
How HingeJoint pins two sprites to a shared pivot point so they rotate around it. Read this before the rotating-arm worked example.
How joint.delete() releases a constraint at runtime so previously-joined sprites become independent. This is the release step in the slingshot pattern.
applyForce(fx, fy) adds a one-frame impulse to a sprite: the physics engine turns it into motion. Read this before 6.13.9 Worked Example: Launch a Sprite with applyForce.
Two numbers: dx and dy: encode the direction from one sprite to another. This is the math behind every force that points somewhere on purpose. Read this before 6.13.9 Worked Example: Launch a Sprite with applyForce.
This is the moment the unit snaps together: a joint holds the ball, you drag it back with the mouse, release removes the joint, and a force vector launches it toward the target. Watch the whole pattern before you read the code.
Turn the plain-English rules of a slingshot into pseudocode: grab, stretch and release, guarded by one variable, with the force applied in exactly one frame.
Three optional stretch prompts for Unit 6.13: build a SliderJoint piston sandbox, a trebuchet that uses a DistanceJoint + HingeJoint together, or a swinging rope chain with three or more HingeJoints.
Graded: build a two-player Pong-Sumo game: two paddles, one ball, push the ball past the opponent to score. Incorporates two-player input, push-collision physics, a win condition, and at least one joint. Auto-graded.
You've built every piece: mouse input, joints, forces, two-player games, state machines, saves. This short video closes Units 6.12 and 6.13 and previews what Unit 8.1 asks you to do: design and pitch your own game from scratch.
→ View full module pageBefore any code: list the parts of the Coin Maze, what the game must remember between frames, what to build first and what looks hard. AI-graded with hints.
A level can be written as rows of text and built with Tiles. Covers the legend, Group defaults, the centre rule for x and y, and level.delete().
A small level built from six rows of text. Change a letter, the legend or the tile size and watch what each one controls.
The screen is empty: three Groups, a map and a player, but no level. Set the defaults on walls, coins and the goal, then build the whole maze from rows of text with Tiles. You can then walk it, and the corner counts the coins left (5).
The map is also data your own code can read. Scan it for a letter, turn a row and column into pixels and a pixel back into a row and column with floor, and check the row and column exist first.
The maze is built, but the player always stands at a fixed spot in the corridor instead of on the P in the map. Scan the map for the P, turn its row and column into pixels, put the player there, and write the way back from pixels to a tile.
The player walks the maze but the coins do nothing and the goal never opens. Pick up each coin when the player touches it, count it in the score, and let the goal win only when no coin is left.
The game has three maps in a list called levels, but the screen is blank and the goal ends nothing. Write loadLevel(n) to throw the old level away and build level n, then make the goal move on to the next level, and win after the last one.
A grid you can change is an array of arrays, and the screen is a picture drawn from it every frame. Build one, draw it with rect, turn a click into a row and a column, check the bounds, flip a cell and count.
An 8 by 8 grid of lights kept as data. The starter has the canvas, the draw loop and the words, and every function you need is there but empty. Build the grid, draw it from the data, flip a cell on a click, and count the lit cells.
A wall of 40 bricks kept as an array of arrays of 1s and 0s. The drawing, the mouse and the words are done. Build the wall with two loops, find the brick under a pixel (the wall starts 60 pixels down), and count the bricks left.
Play your finished Coin Maze to the end and clear your brick wall, try to break each, find one surprise, link it to your code and choose one change. AI-graded with hints.
Seven multiple-choice questions on rows and columns, pixels and cells, the offset, bounds and level.delete(). Checked instantly.
The brick wall is complete. Change one rule of your own: points by row, two-hit bricks, or a wall read from rows of text. Pick one; add an idea of your own on top if you like.
→ View full module pageA sound is a file the sketch downloads: load it once in setup(), play it on an event. play() starts a copy, loop() keeps one going, .volume, .rate and masterVolume() set how it sounds, and a browser may make no sound until the player clicks or presses a key.
One chime at four speeds on the keys 1 to 4, and a tune that T loops and X stops. Hold a key with kb.pressing, press T three times, and start the tune in setup() to see what each line does.
Star catch makes no sound yet. Load two sounds once, in setup(), then play a chime for each star you catch and a low thud for each one you miss, each in the one place where its event happens once.
A tune loops under Star catch, quieter than the effects. The up and down keys step its volume between 0 and 10, and M turns every sound off and on again.
The same sound every time tires the ear. Give each catch a random pitch with .rate and random(), and give each miss one of three thuds picked at random from a list.
Music changes when the screen changes, once, in the one function every change of screen goes through: stop the old music, then start the new screen's. One tune gives four moods with .rate. Sound settings are saved when they change and loaded at the start, with !== null so a saved 0 is kept.
Star catch has a title, the game, a win and a loss, and every change of screen goes through goTo(next). Make goTo change the music: stop what was playing, loop the tune on the title and in the game, and play it once for a win or a loss.
A sound options screen: up and down step the level, M mutes, and both are saved with storeItem when they change and loaded with getItem when the game starts, so the game remembers them.
Eight multiple-choice questions on the browser's rule, loading once, play and loop, rate, a random pick, stopping the music on a new screen, and a saved 0. Checked instantly.
Your Star catch has sound, music and saved options. Add one sound rule of your own: a streak that climbs, a chime that comes from where you caught it, or chords cut from one file. Pick one; add an idea of your own on top if you like.
→ View full module pageBefore any code: list the parts of Sling, what the game must remember between frames, what to build first and what looks hard. AI-graded with hints.
A catapult aims by rotating about its pivot; angleTo gives the angle and rotateTo turns at a speed.
One bar, one pointer, one angle. Aim before there is a wall.
A catapult on a base, aiming at the pointer. This is the first half of the game.
→ View full module pageA shot is a sprite you make on release, given a direction and a speed, and kept in a list.
One arm, one stone, one arc. Launch on release and watch gravity bend the shot.
The launch with the sweep already in it: three shots, then the list stays empty as they leave.
The catapult fires: aim with the arm, release to launch, and watch the arc.
→ View full module pageEvery sprite you make needs two ways out: off the screen, and out of the array.
One stone, one list, one sweep. Remove what leaves the screen from both places.
The catapult fires and the list cleans itself up, however many stones you launch.
→ View full module pageA block keeps its own hit count; a shot leaves on the frame it hits, so it counts once.
One shot, one block, two hits. Take one off per shot and let the shot leave.
A wall of blocks, each with its own hit count. Knock them out one shot at a time.
→ View full module pageA budget of five stones: win when the wall is down, lose when the stones are gone.
Two planted bugs. The wall collapses before the first shot, and the last stone never counts.
→ View full module pagePlay your Sling at least three times, find one thing that surprised you, link it to your code and choose one change. AI-graded with hints.
Five multiple-choice questions on the arm, the launch, the sweep, the hit budget and the ending. Checked instantly.
Three extensions: wind, a second stone after a pause, and a stone block that needs three hits.
→ View full module pagePlay the finished Trail game before you build any of it, on one computer or online with a classmate. Names the parts it is made of and the module where each one is built, and says plainly which parts come later.
Before any code: list the parts of Trail, what the game must remember between frames, what to build first and what looks hard. AI-graded with hints.
A board is a list of squares in walking order; the track is one line of text, and each square's row, column and centre come from its index.
Six squares in a list, one loop, one number on each. The picture is drawn from the data.
The whole board from one line of text: rows that snake back and forth, and a token that steps along them to prove the order.
→ View full module pageA die is floor(random(1, 7)); players are a list of objects; turn is an index passed on with %; one function does a whole turn, and min keeps a token on the board.
One die, two names, one turn index. Roll and pass before there is a board.
Two players, one die: roll, move, pass the turn, and stop on the last square to win.
→ View full module pageAfter the move, read the letter of the square you landed on and let an if per letter decide: jump ahead, slide back, or wait a turn with a flag.
Six squares, two letters, one token. After each step, the letter under the token decides what happens.
The letters on the board come alive: J jumps ahead 3, S slides back 3, and W makes a player miss a turn.
→ View full module pageonline lets a sketch play a classmate on another computer: host or join a room, send a move, and apply every move, your own too, in onMove, so both boards stay the same.
Two tabs, one room, one number at a time. Every number sent, yours too, arrives in the same order on both.
Your Trail plays a classmate on another computer: rolls are sent, every roll is checked and applied in onMove, and only the player whose turn it is may roll.
→ View full module pagePlay your Trail at least three times, once online if you can, find one thing that surprised you, link it to a line of your code and choose one change. AI-graded with hints.
Five multiple-choice questions on the snaking path, passing the turn, min, onMove and the waiting flag. Checked instantly.
Your Trail is complete. Change one rule of your own: three players, a token that hops one square at a time, or a new letter. Pick one; add an idea of your own on top if you like.
→ View full module pagePlay the finished checkers game before you build any of it, on one computer or online with a classmate. Names the parts it is made of and the module where each one is built, and says plainly which parts come later.
Before any code: list the parts of checkers, what the game must remember between frames, what to build first and what looks hard. AI-graded with hints.
A checkers board is a grid of letters built with two loops; a square is dark when (r + c) % 2 === 1; black fills the top three rows and red the bottom three; the picture is drawn from the grid.
Two loops, one test with %, one rect per square: the light and dark board drawn from row and column numbers.
Fill the empty grid: black on the dark squares of the top three rows, red on the bottom three. The drawing is already there, so the board appears as the letters do.
→ View full module pageA click becomes a row and a column with floor; picking a piece up is remembering { r, c }; a step is one square diagonally forward with abs, onto an empty square; every rule lives in one function the click only asks.
One token on a small board: a click becomes a row and a column, a click on the token picks it up, and a click one square diagonally away puts it down there.
Red and black take turns: click one of your pieces to pick it up, click a square one step diagonally forward to move it, and every rule lives in moveKind.
→ View full module pageA jump is two squares diagonally over a piece of the other colour, found halfway between the ends and taken off; after a jump, a piece that can jump again keeps the turn.
Red jumps black: two squares diagonally, over the halfway square, and the piece jumped over is gone.
moveKind learns a second answer, jump; doMove takes the jumped piece; and a piece that can jump again keeps the turn until it cannot.
→ View full module pageA piece on the far row is crowned ('r' becomes 'R'); toLowerCase keeps a king on its colour; a king may move backward; crowning ends the turn; a player with no move at all loses.
One red piece steps up the board; on the top row it becomes a king, 'R', which may also step back down.
Pieces are crowned on the far row and kings move both ways; crowning ends a chain; a player with no move left loses, and R plays again.
→ View full module pageWhat is new over 6.25.1: a move is four numbers, a click sends it instead of moving, onMove runs isLegal before doMove so a bad move is ignored on both computers, and the host plays red.
H hosts, JOIN joins, and a click sends the square you clicked: every click, yours too, arrives in onMove and is marked on both computers.
Your checkers plays a classmate on another computer: a click sends four numbers, every move is checked by the same rule function and applied in onMove, and only the player whose turn it is may click.
→ View full module pagePlay your checkers at least three times, once online if you can, find one thing that surprised you, link it to a function in your code and choose one change. AI-graded with hints.
Five multiple-choice questions on dark squares, the halfway square, kings and toLowerCase, crowning in a chain, and checking a move in onMove. Checked instantly.
Your checkers is complete. Change one rule of your own: show the legal squares, a draw after 40 quiet moves, or jumps you must take. Pick one; add an idea of your own on top if you like.
→ View full module pageClasses and Objects slides: this, and procedural vs OOP. Placeholder until the deck is rebuilt from bookSHelf.
4-min DevTools walkthrough. Opens a running moSHion sketch, inspects a Sprite instance, and names what a class is. Watch before the DevTools reveal example.
The words class and instance and how they relate: a class is a blueprint; new builds one instance from it. Read before 7.1.4.
What new does mechanically: allocate, run constructor, return. Read right after 7.1.3.
How the constructor receives arguments from new and stores them on this. Read right after 7.1.4.
One small class with each part labelled: the class name, the constructor, its parameters, and the properties it stores on this. Follows 7.1.5 (Reading: constructor and its parameters).
A property is data stored on a single instance via this.name = value. Read before the property labs.
Read b.color and b.size off a Box instance and print them to the on-canvas console using console.log. First practice with dot-notation reads.
Mutate b.color on a space-bar press to practice assigning a new value to an instance property. First practice with dot-notation writes.
Instantiate b1 and b2 from the same class with different colors, then mutate only b1 to confirm each instance's state is independent.
this always refers to one specific thing: the instance the method was called on. Read before the substitution rule example.
Low-stakes autograded practice. Instantiate the Sprite class twice (rectangle form and circle form), set properties on each instance, and give one sprite a stroke. Bridges the 7.1.7 / 7.1.13 worked examples and the 7.2.11 Enemy class worked example.
A tour of the Sprite class re-read as OOP. Every new Sprite(...) is a constructor call; every .color / .stroke is a property on an instance.
Low-stakes autograded practice. The class shell is given; you write the constructor body that stores three arguments on this, then build two instances with different values. Follows 7.1.15 (Worked Example: Sprite Showcase) and comes before the Enemy class in 7.2.11.
→ View full module pageMethod declaration syntax: inside a class body, methods are written without the function keyword. Read before the method labs.
3-min whiteboard walkthrough of this inside methods. Shows why this.color and this.hp refer to the specific instance the method was called on.
Write Counter.tick(): a method that takes no arguments and mutates this.n. First method you write from scratch.
Add Counter.addBy(n): a method that takes an argument and uses it to increment this.n. Keys 1/2/3 add different amounts.
Add Counter.isHigh() which returns true when this.n > 10. The driver (the code in draw()) uses the return value to color the display red.
Write Counter.bigStep() which calls this.addBy(5) and returns this.isHigh(): one method dispatching another on the same instance.
Turn five plain-English steps into pseudocode: one decision, two calls to other methods, and a step that runs either way.
Composition over inheritance: why wrapping a Sprite as this.sprite is safer than inheriting from it. Read before the sprite mutation labs.
Write Mover.moveRight(dx) which adds dx to this.sprite.x, reaching through composition to move the wrapped sprite.
Write Bubble.pop() which calls this.sprite.delete() so the object removes its own sprite on click.
Instantiate e1, e2, and e3 from the Enemy class at three different positions: three independent instances, each in its own named variable.
Store five Enemy instances in a single array by pushing new Enemy(...) calls into enemies: practice managing many instances without separate named variables.
Write a for...of loop in draw() that calls .render() on each enemy: dispatching a method to every element in the array with one loop.
Side-by-side comparison of the same problem (an 'enemy fleet') solved two ways: with parallel arrays (procedural) and with an array of class instances (OOP). Read between the Enemy class example and the Procedural-vs-OOP example.
The same feature drawn twice, procedural and object-oriented. No drawing: read both and answer what happens when a fourth enemy arrives.
Three yes-or-no questions that tell you whether a class is the right tool. Read after the Procedural vs OOP example.
Write a Collectible class, instantiate at least 5, and detect overlap with the player. SLO-2 lab: the class is the point. Auto-graded.
Comparison of procedural and object-oriented programming.
Name the three OOP pillars you'll encounter in downstream courses: no implementation required this week. Read at the close of 7.2.
Pick one (or more) OOP stretch challenges: extend your Enemy class, write a Player class, or try subclassing with extends. Auto-graded.
A method can reach a global, a property on this, or a local it declares itself. Only the property survives the call. Extends 3.2.24's local-versus-global with the third place, and says why a parameter dies too.
A tick() method that declares let n = 0 and writes it out again, so the number on screen never moves. Then the one-line fix: change this.n directly.
The starter's tick() changes a local, so the number on screen stays at 1. Make the change land on this.n so it survives the call.
add() declares its own let step = 3; undo() types the 3 again. A local in one method is invisible to the next, so the two numbers can drift. Put the step on this in the constructor and both methods use it.
A property is open: any code holding the object can write it. Shows health counting down past zero while the enemy is still on screen, and the alternative — a method that owns the rule, so the outside asks the class instead of doing its arithmetic.
The same Enemy twice: once with draw() doing the subtraction and the death check, once with takeHit(n) and isAlive() inside the class. Ends by trying to break the class from outside, to show what encapsulation does and does not promise in JavaScript.
Six multiple-choice questions on where a variable lives, why a local cannot be shared between methods, and what a method that owns a rule buys you. Checked instantly.
The enemy starts at 5 health and is hit for 2 at a time. Write takeHit(n) so that health comes off and never goes below zero — the rule lives in the class, not in the scene.
The scene asks hp > 0 twice, by hand. Write isAlive() on the class and ask it instead, so the question 'is this enemy still up?' has exactly one answer in one place. What you see on screen does not change.
In a.distanceTo(b) the method has two instances in play: this is the receiver, other is the parameter. Shows where that symmetry ends — player.hit(enemy) and enemy.hit(player) mean opposite things.
The scene hits the enemy directly, then a Player class takes over with hit(other) calling other.takeHit(this.power). Changing the player's power then changes the fight without touching Enemy.
The enemy already knows how to take a hit; the player is missing its half of the exchange. Write hit(other) so the receiver's power is applied to the object passed in.
Dead enemies stay in the array, so the list never shortens and the next hit lands on a corpse. Build a new list of the living with filter and store it back in enemies.
A static property belongs to the class rather than to an instance: Enemy.spawned counts every enemy ever built, and e.spawned is undefined. Also separates this keyword from moSHion's unrelated 'static' body type.
A static spawned counter bumped in the constructor, so it counts every enemy ever created rather than the ones still on screen. Also shows what resetting it from draw() every frame does.
The scene already prints Enemy.spawned, which is undefined because nothing declares it. Add a counter that belongs to the class and bump it in the constructor, so every enemy ever built is counted.
Assembles the module: a frameCount timer spawns enemies, the array is reaped with filter, and a wave only arrives once the field is clear. Closes with a table of which job belongs to the class, the array, and the scene.
Build the spawner yourself: a frameCount timer that sends three enemies only when the field is clear, a hit that goes to the first one, and a filter that reaps the dead. Uses every idea in the module.
Three numbers from the wave spawner, and for each one: a local, a property on this, or a class variable — plus one sentence on why. Formative, AI-checked, no points.
Eight multiple-choice questions closing Unit 5: class versus instance, the constructor, this, method syntax, separate state on two instances, arrays of instances, where a variable lives, and what a class variable is. Checked instantly.
→ View full module pageBefore any code: list the parts of Defender, what the game must remember between frames, what to build first and what looks hard. AI-graded with hints.
Two small ideas carry Part A: two ifs keep the ship on the canvas, and a cooldown you start yourself spaces out the shots. Also why moving everything by hand inside if (playing) makes game over free.
Hold Space and the ship fires one shot every 12 frames. Change COOLDOWN to 0, 4 and 30 and watch the gap between the shots.
The ship slides off the canvas and Space does nothing. Keep the ship on the canvas with two ifs, fire on a cooldown, and delete the shots that leave the top.
→ View full module pageoverlaps() asks whether two sprites touch this frame, whatever their collider. Why colliding() cannot see a shot, why the shot must leave on the frame it hits, and how the drone goes back to the top.
Shots fly straight through the falling drone. Use overlaps() so a shot that touches it scores, leaves the screen and the array, and sends the drone back to the top.
The drone can land as often as it likes. Give the base 3 hp, take 1 for every landing, end the round at 0, write Game over on top, and let R start a new round.
Six multiple-choice questions on keeping the ship on the canvas, the cooldown, removing shots, overlaps() and the playing gate. Checked instantly.
→ View full module pageFrom one drone to many enemies. Each enemy's hp and worth sit in two more arrays beside the sprites, on purpose, and every push and every splice has to happen to all three.
The drone is gone and enemies arrive on a beat, but nothing builds or moves them. Write spawnEnemy with one push per array, and the loop that makes enemies fall, land and leave all three arrays.
→ View full module pageBefore any code: say in plain words how every shot meets every enemy, what a hit does to the shot and to the enemy, and which lists change. AI-graded with hints.
The hit check as a loop inside a loop: why both loops run backwards, why the inner one breaks straight after a hit, and what a kill removes from all three arrays.
Shots fly straight through the enemies. Write hitEnemies: every shot against every enemy, a hit that removes the shot and takes 1 hp, and an enemy at 0 hp that scores its worth and leaves all three arrays.
→ View full module pageEnemies come in waves: a new wave only when the field is clear, after a countdown. Delete the clear-field check and watch the waves pile up.
Enemies stop arriving on a beat and come in waves instead: each wave only after the field is clear and a pause has run out, each one bigger and faster. Write nextWave and spawnWave, and start every round at wave 0.
The finished Part B game with one line missing. After a landing, a crimson 1 takes three shots and an orange 3 dies in one. Make it happen, find the line, fix it.
Six multiple-choice questions on parallel arrays, the nested hit loop and its break, waves that wait for a clear field, and what one more enemy fact costs. Checked instantly.
→ View full module pageCount what Part B's parallel arrays cost (8 splices, 13 lines, two removal copies), run the checklist on bullet, enemy and spawner, and see where every fact lives after the rebuild.
Before any code: say what Bullet, Enemy and Spawner each remember and can do, one job that moves into a class, and which class fails the checklist's first question. AI-graded with hints.
An Enemy class and the two-line reap: objects only change their state, and once a frame the scene removes finished ones from the screen, then from the list. Break it two ways and watch the ghosts.
The game is Part B's, with a new Enemy class nothing uses yet. Finish the class, swap the three parallel arrays for one array of Enemy objects, and remove finished enemies in one place. The game must play exactly as before.
→ View full module pageShots become Bullet objects. Write isAlive, hits(enemy) and spend, let fire() build a Bullet, and the hit loop loses every splice and its break; one function clears finished shots and enemies.
The waves move into a Spawner class: ready() says when the next wave is due and makeWave() builds it. A restart becomes new Spawner(), and Enemy counts the enemies it has built with a static counter.
→ View full module pagePlay your finished Defender at least three times and lose in three different ways, find one surprise, link it to a class or function, and compare one change with Part B. AI-graded with hints.
Seven multiple-choice questions on where things live after the refactor: hp on the enemy, a hit loop with no splices, what filter does not do, a parameter that is another object, static, the checklist, and the cost of a new fact. Checked instantly.
The game gets sound. Load a sound once in setup(), then play it from inside methods you already wrote: a zap from the Bullet constructor for every shot, and a boom from takeHit() for every enemy a shot finishes. A mute key is optional.
The game is complete. Change one rule of your own: a best score that survives a restart, a boss every fifth wave, or a Ship class that owns its own cooldown. Pick one; add an idea of your own on top if you like.
→ View full module pageBefore any code: list the parts of Breakout, what the game must remember between frames, what to build first and what looks hard. AI-graded with hints.
The ball is moved by your code: two speeds, vx and vy, and a bounce is a flipped sign. The walls are R away from the centre, the paddle follows the mouse or the keys, and where the ball lands on the paddle steers it.
A ball that bounces off three walls and a paddle that follows the mouse. Catch it on different parts of the paddle, take the steering away, and move the walls to see what each line controls.
A paddle along the bottom that follows the mouse, or the arrow keys, and never leaves the screen. The canvas and the paddle are made for you.
The ball moves by two speeds you control. Bounce it off three walls and the paddle, let the paddle steer it, and serve it again when it falls out.
→ View full module pageThe wall comes back from 6.14.11, written as rows of text this time. Build it from the text, draw it from the data, and let the ball's centre break bricks.
Testing only the ball's centre lets it sink into a brick and slide past one it only scrapes. Test the four points on its edge instead, and flip vy for a brick above or below, vx for a brick beside it.
The ball breaks bricks with its centre and sinks into them. Test its four edges instead, and send it back up-and-down or across depending on which edge hit.
→ View full module pageThree balls to clear the wall. Count the bricks left, take a life for every ball that falls out, and end the game when the wall is cleared or the balls run out.
A title screen that waits for a key: 1 plays with the mouse, 2 with the arrow keys. Write the choices, read the key, and send R back to the title. With a note on prompt().
→ View full module pagePlay your finished Breakout with the mouse and with the keys, try to break it, find one surprise, link it to your code and choose one change. AI-graded with hints.
Eight multiple-choice questions on flipping a speed, the radius, the paddle bounce, steering, the ball's edges and prompt(). Checked instantly.
Your Breakout is complete. Change one rule of your own: a third mode, bricks that take two hits, or a second wall. Pick one; add an idea of your own on top if you like.
→ View full module pagePlay the finished Quest game before you build any of it, on one computer or online with a classmate. Names the parts it is made of and the module where each one is built, and says plainly which parts come later.
Before any code: list the parts of Quest, what the game must remember between frames, what to build first and what looks hard. AI-graded with hints.
One Fighter class with a constructor, isAlive() and a draw(x, y) method; an hp bar is a rect scaled by hp / maxHp; two fighters in one list, fighters[0] you and fighters[1] the one you face.
A Bar class with a draw(x, y) method: a grey bar, and on top of it a coloured bar scaled by value / max. Two bars from one class, each drawing itself.
Fill in the Fighter class's draw(x, y): a body, a name and an hp bar scaled by hp / maxHp. The hero and the goblin are already made; each one draws itself.
→ View full module pageattack(target, roll) hits through the target's takeHit, which keeps hp at 0 or more and returns the damage; turn = 1 - turn passes the turn; after(45, enemyTurn) gives the enemy its turn a moment later.
Press 1: one dummy's hit(other) makes the other take a hit, never below 0, and after(45, ...) lets the other one hit back a moment later.
Your hero and the goblin take turns: 1 attacks through the target's takeHit, the turn passes, the enemy hits back after a pause, and the battle ends with a win or a loss and R to play again.
→ View full module pageA guarding flag halves the next hit with floor(n / 2) and is cleared by it; a potions count heals with min(hp + 12, maxHp) and runs out; one act(t, a, roll) does all three actions, picked with 1, 2 and 3, and the enemy chooses with a simple rule.
A Knight keeps a guarding flag, cleared by the next hit, which halves that hit with floor(n / 2), and a potions count that heals with min(hp + 12, maxHp) until it runs out.
Each turn is a choice: 1 attacks, 2 guards (the next hit is halved) and 3 drinks a potion. One act(t, a, roll) does all three, for you and for an enemy that chooses for itself.
→ View full module pageA kind of enemy is a plain object in a list, KINDS; map turns the list into Fighters; which says which one you face and moving on points fighters[1] at the next; levelUp() changes the hero's own state; the last win ends the game.
KINDS is a list of plain { name, hp } objects; map turns it into a list of Monsters, and N moves which one you are looking at, stopping at the last.
Your hero fights a run of enemies made from KINDS with map: beating one levels you up and brings the next, and beating the last one wins.
→ View full module pageOnly what is new over 6.25.1 and 6.31.1: a duel uses the same act; a move is { act, roll } and the sender rolls, so both computers use the same roll; goodMove checks both are whole numbers in range; only the seat whose turn it is may act.
H hosts, JOIN joins, and 1, 2 or 3 sends that action: every action, yours too, arrives in onMove and is listed on both computers with the seat that sent it.
H hosts a duel, Red against Blue, with a classmate on another computer: a choice sends { act, roll }, act runs in onMove only for the seat whose turn it is and only for a good move, and the campaign still plays offline.
→ View full module pagePlay your Quest at least three times, the whole run once and a duel online if you can, find one thing that surprised you, link it to a method or function in your code and choose one change. AI-graded with hints.
Five multiple-choice questions on the hp bar, after(), guarding, making enemies from KINDS in newGame, and why the sender rolls in a duel. Checked instantly.
Your Quest is complete. Change one thing of your own: a fourth enemy kind, a special move with a cooldown, or a shop that spends gold. Pick one; add an idea of your own on top if you like.
→ View full module pageQ2 synthesis: ship a game you designed. The checklist is the spec: twelve things the game must contain. Everything else is your call.
Reflect on the game you shipped and the process that got it there. AI-graded with hints.
→ View full module page