SD5913 / WEEK 07 / 22 OCTOBER 2026
Build something
amazing.
Recap. Midterm. One class, two views. Your team’s next big idea.
SD5913 / WEEK 07 / 22 OCTOBER 2026
Recap. Midterm. One class, two views. Your team’s next big idea.
TODAY / RECAP → QUIZ → BUILD
01 Before 10:00 / key slides from Weeks 1–6, then Ask Me Anything
02 10:00–10:30 / midterm on Canvas / 40 questions
03 10:30–10:35 / break
04 10:35–10:45 / ball classes demo, inspiration and team setup
05 10:45–11:00 / form your team and submit your idea
06 11:00–11:15 / submit one image mock-up
07 11:15–11:20 / check submissions and wrap up
04 · PROGRAMS
STATE 0
A blank canvas, a file, a number.
PROGRAM
Step, step, step…
STATE 1
A picture, a saved file, a result.
07 · TOOLS · 03
Git tracks every change on your computer. git-scm.com
GitHub keeps a copy online and lets others see it. github.com
github.com/settings/education/benefits — add your PolyU email firstgithub.com/git-guidesGitHub Education only accepts a PolyU address — polyu.edu.hk, connect.polyu.hk and the other school-issued domains.
03 · THE SHIFT
Every exercise this week is one of these, and so is every quiz question:
None of them ask you to write a program from a blank file. That comes later, and by then you will be able to tell whether what you wrote is right.
04 · TYPES
3 int a whole number 3.14 float a number with a decimal point "3" str text. The quotes are what make it text True bool yes or no [3, 1, 4] list several things, in order {"n": 3} dict values you look up by name
You will meet tuple and set later. These six carry the whole course.
05 · THE LINE THAT FORBIDS IT
cap = (... and last_square_empty)
last_square_empty was set by the previous h in the same w — the cell above. So a cap is only drawn under an empty cell, and the picture can be checked: find a cap under a bar and the code is wrong.
That is a specification. A sentence about the output that is either true or false. To keep it true, the program has to remember one thing from the cell before — that is what last_square_empty is for.
07 · UV
03 · A LOOP
for hour, height in enumerate(heights, start=1):
hour and height mean something different every time roundThe same pattern can update a picture instead of printing a value.
03 · A FUNCTION
def bar(height): — something goes in, something comes out.
return, Python returns None; callers must handle that value.Check the returned value when you use a generated function.
04 · FOUR RULES
CACHE
Fetch once, keep the file
Fetch, save the raw reply into data/, then parse the file. Your script runs with no internet, and the committed file is what makes the repo reproducible.
HTML
Same idea, messier
No JSON? A web page is a tree, and one line of BeautifulSoup walks it: select("table.wikitable"), then the rows. The typhoon season table on Wikipedia is one.
ROT
Watch the line rot
The tidal-stream endpoint behind week 2's rings moved in 2023 — fetch_tides.py says so in a comment. A cached file outlives the URL it came from.
POLITE
Be polite
A User-Agent that says who you are and what for. One request, not a loop of them. You are a guest on somebody else's server.
07 · FIVE WAYS
a line · bars · the clock · thirty days overlaid · September as a grid, one row per day, one cell per hour
02 · THE PATH
INPUT
The day selector supplies 17.
STATE
The current run sees day = 17.
RESPONSE
The chart draws that record.
05 · THE LOOP
01 Write the test
Say what response would convince you.
02 See it fail
Read the failure: does it point to the missing feature?
03 Add the route
Implement the smallest change that meets the promise.
04 Run it again
The same test now passes.
04 · FRONTEND / BACKEND · 1 OF 2
04 · FRONTEND / BACKEND · 2 OF 2
01 · SPATIAL AXES + COLOUR CHANNELS
03 · IMAGE VS VIDEO
One RGB image: height x width x channels.
A raw frame sequence: frames x height x width x channels.
Playback speed and frame order shape the motion we perceive.
A simple animation is a list of still images in order.
frame 0 -> time 0 frame 1 -> time 0.2 s frame 2 -> time 0.4 s same frames + new order = different motion
04 · U-NET · TRAINING AND GENERATION
01 · ORDERED VALUES
A mono sound can use a one-dimensional array.
Each number describes the signal at one instant.
The index tells us which sample comes next.
Zero is the centre of this signed signal.
samples = [
0.00, 0.04, 0.08,
0.04, 0.00, -0.04,
-0.08, -0.04
]
print(samples[2]) # 0.08
01 · THE AUDIO CLOCK
22,050 samples per second.
Two seconds need 44,100 mono samples.
Duration = sample count / sample rate.
sample_rate = 22050 seconds = 2 count = sample_rate * seconds print(count) # 44100 # one sample per time step time = index / sample_rate
02 · TWO DIFFERENT RATES
Keep SAMPLE_RATE at 22050.
Change FREQUENCY from 220 to 440.
Predict what changes and what stays the same.
# sample clock SAMPLE_RATE = 22050 # repeating waveform FREQUENCY = 440 # unchanged duration SECONDS = 2
BEFORE 10:00 / CLASSPOINT / YOUR QUESTIONS
What still feels unclear?
Send your questions before the 10:00 test.
ClassPoint · short answer — answer on the projector
MIDTERM / 22 OCTOBER / 10% OF COURSE
40 multiple-choice questions. 30 minutes. Open book.
The test covers taught material from Weeks 1–6.
Open the quiz when instructed. Report access problems immediately.
Follow the announced rules for tools and collaboration.
CANVAS / 40 QUESTIONS / 30 MINUTES
10:30–10:35 / AFTER THE CANVAS TEST
AFTER THE BREAK / CLASSES / PFAD WEEK 7
class Ball: def __init__(self, x, y, vx, vy): self.x = x self.y = y self.vx = vx self.vy = vy self.radius = 1
Ball is the class. Each object gets its own position and velocity.
AFTER THE BREAK / CLASSES / PFAD WEEK 7
class Ball: # __init__ is shown on the previous slide. def update(self, seconds): self.vy += GRAVITY * seconds self.x += self.vx * seconds self.y += self.vy * seconds
GRAVITY = 28. self is this ball; seconds is the time to advance.
AFTER THE BREAK / CLASSES / PFAD WEEK 7
red = Ball(x=16, y=8, vx=14, vy=-5) blue = Ball(x=44, y=14, vx=-10, vy=-9) red.update(0.1) print(f"red=({red.x:.2f}, {red.y:.2f})") print(f"blue=({blue.x}, {blue.y})")
Predict first. Run ball.py to check which object moves.
ONE MODEL / TWO VIEWS
x, y, vx, vy
R B
Both views read the same Ball objects.
LAPTOP DEMO / WATCH, PREDICT, SAVE
From pfad: uv run week07/ball_both.py
Keep week07/ball.py open beside the two views.
Predict: what changes if GRAVITY goes from 28 to 56?
Save. Both views reset and use the edited class.
NEXT / 10:45–11:15 / YOUR GROUP PROJECT
INSPIRATION / REINVENT AN APP
Choose an app you know, or a tool you genuinely need.
Observe one useful behaviour. Describe its inputs, outputs and edge cases.
Rebuild that interaction in your own way. Add the feature you wish existed.
INSPIRATION / GAME MASHUPS
What if a puzzle game had rhythm? What if a racing game changed with sound?
Combine mechanics around one compelling player action.
Give the result its own rules, look and sound.
AMBITION / A BIG VISION, A FIRST PLAYABLE MOMENT
Imagine the version you would love to use or play.
Choose one interaction that makes the idea special.
What will a person do? What changes? What feedback tells them it worked?
Identify the hardest assumption. Make that your first experiment.
10:44–10:45 / TEAM REGISTRATION
Watch Gio demonstrate the actual Canvas group-registration route.
Form a team around an idea you want to build together.
Choose one representative for the text and image submissions.
Use the same team name on both. Ask for help if you need a team.
10:45–11:00 / TEAM TEXT · 01 / TEAM IDEA
Join the same Canvas team. Pick a direction everyone wants to make.
Describe who it is for, what they do, and how your app or game responds.
Name what you will reinvent or combine, and the first interaction you will test.
One representative submits one idea text on ClassPoint, with your team name.
ClassPoint · short answer — answer on the projector
11:00–11:15 / TEAM IMAGE · 02 / PROJECT MOCK-UP
Sketch, mock up or generate one image of the app or game in use.
Show the main screen or moment of play. Label the action and response.
Match the idea you just submitted. A photographed paper sketch is fine.
The same representative submits one image on ClassPoint, with the team name.
ClassPoint · image upload — answer on the projector
11:15–11:20 / CHECK AND WRAP UP
Your idea text and image mock-up are both visible in ClassPoint.
Both use the same team name and describe the same project.
Everyone has joined the correct Canvas team.
Reopen both submissions together; ask for help before leaving.
GROUP PROJECT / 40%
One shared GitHub repository showing everyone’s contributions.
Original code and multimedia. Credit the tools and assets you use.
Agree the project scope by Week 8.
Today’s idea and mock-up are the starting point for that conversation.
SEPARATE / INDIVIDUAL ASSIGNMENT 3 / 15%
Due Sunday 1 November 2026, 23:59 HKT.
Build something with meaningful user input and clear feedback.
Submit your own GitHub repository URL on Canvas.
Follow the existing brief, README, PROCESS and credit requirements.
An idea worth making. An interaction worth trying.
SD5913 / WEEK 07 / 22 OCTOBER 2026