CPSC 203, 2025 W1
September 18, 2025
EX1 in the books. Nice work. A few little bugs in questions, but avg is already 93%.
Many office hours this week to help w machine setup. You’ll need it for Projects, and for your future.








![]()
![]()
![]()
A handcraft is a collection of __________. Every __________ has a __________, and a collection of __________. Every __________ is a collection of __________. Every __________ is either “knit” or “purl,” and is drawn as a __________.
Decompose a problem into classes
List the data associated with each class
Write the “driver” code that illustrates the functionality you expect from each class.
Implement the functions you expect.
Run the driver code to test your functionality.

Handcraft:
Block:
Row:
Stitch:
Image:
From stitch coordinates to pixel coordinates
ImageDraw.Rectangle(xy, fill):
https://us.prairielearn.com/pl/course_instance/193300/assessment/2590319
A row has a list of stitches:
But we want to declare rows like:
To do this, we need a function to translate between string of K, P and stitch objects.
Define __init__: special function invoked for you by the system when variable is declared.