0b100b110 in base 10?
0b110 0x100xA5 in base 10?
0xA5 
| Base 10 | Base 2 | Base 16 | Base 10 | Base 2 | Base 16 | |
|---|---|---|---|---|---|---|
| 0 | 0000 | 0 | 8 | 1000 | 8 | |
| 1 | 0001 | 1 | 9 | 1001 | 9 | |
| 2 | 0010 | 2 | 10 | 1010 | A | |
| 3 | 0011 | 3 | 11 | 1011 | B | |
| 4 | 0100 | 4 | 12 | 1100 | C | |
| 5 | 0101 | 5 | 13 | 1101 | D | |
| 6 | 0110 | 6 | 14 | 1110 | E | |
| 7 | 0111 | 7 | 15 | 1111 | F |
Humans think about numbers in base 10, but computers "think" in base 2. Binary encoding is what lets computers do all the amazing things they do!
0b0, 1 → 0b1, 2 → 0b10, etc.0x435345, yay → 0x7961790x0, 0x1, 0x2, 0x3, 0x4, 0x5So what does 0x4E6F21 mean? It depends! It could be the number 5140257, the characters "No!", or a color. It's up to the program to decide how to interpret the bits.
#800000#FFD700#E2661A#33997Ey → 0x79, a → 0x610x796179

giraffe.jpg) in a text editor or hex viewer to see the raw bytes
Python
import random
roll = random.randint(1, 6)
print("You rolled", roll)
JavaScript
let roll = Math.floor(Math.random() * 6) + 1;
console.log("You rolled " + roll);
Lua (Roblox uses a version of Lua called Luau)
local roll = math.random(1, 6)
print("You rolled " .. roll)
import java.util.Random;
public class Dice {
public static void main(String[] args) {
Random rng = new Random();
int roll = rng.nextInt(6) + 1;
System.out.println("You rolled " + roll);
}
}
#include <iostream>
#include <cstdlib>
#include <ctime>
int main() {
std::srand(std::time(nullptr));
int roll = std::rand() % 6 + 1;
std::cout << "You rolled " << roll << "\n";
}
| Language | Random number 1–6 | Show it |
|---|---|---|
| Python | random.randint(1, 6) |
print(...) |
| JavaScript | Math.floor(Math.random() * 6) + 1 |
console.log(...) |
| Lua | math.random(1, 6) |
print(...) |
| Java | rng.nextInt(6) + 1 |
System.out.println(...) |
| C++ | std::rand() % 6 + 1 |
std::cout << ... |
Every version does the same algorithm: get a random number, store it, show it.
| Language | Where you'll see it |
|---|---|
| C++ | Unreal Engine, most big console and PC games, Minecraft: Bedrock Edition |
| C# | Unity (many indie and mobile games) |
| Luau (a version of Lua) | Roblox |
| Java | Minecraft: Java Edition, Android apps |
| JavaScript | Browser games and websites |
| GDScript | Godot engine |
| Python | AI, data, game tools; beginner games with Pygame |
Java is to JavaScript as car is to carpet.
| Rank | Language | Rating |
|---|---|---|
| 1 | Python | 19.23% |
| 2 | C | 11.33% |
| 3 | C++ | 8.87% |
| 4 | Java | 8.41% |
| 5 | C# | 3.79% |
| 6 | JavaScript | 2.77% |
| 7 | Visual Basic | 2.20% |
| 8 | R | 2.06% |
| 9 | SQL | 1.97% |
| 10 | Rust | 1.44% |
Live version: tiobe.com/tiobe-index
Discussion: Why might these lists be different? What does "popular" even mean?
int score vs. float speed makes you think about your data// Java, C#, and C++: the exact same line
if (lives == 0) {
gameOver = true;
}
// JavaScript: almost the same
if (lives === 0) {
gameOver = true;
}
# Python: a different style
if lives == 0:
game_over = True
The same die roll in Processing:
int roll = int(random(1, 7));
println("You rolled " + roll);

Your first sketches: shapes, colors, and debugging
CONTENTS - Click any link to jump to that slide. Every slide's footer has a "Contents" link that brings you back here. - The lesson overview, timing, and sources are in the notes on the next slide (the title slide). - Links work in the HTML version (GitHub Pages) and in a browser. They may not work in the VS Code preview.
Lesson overview: the first deck of Unit 2 (Drawing with Code), in five parts. Teach it before processing-intro.md ("Processing Intro"), which picks up with drawing in Processing. After that come variables.md ("Variables", Unit 3) and functions.md ("Functions", Unit 4). algorithms.md ("Algorithms") is unplugged and fits Unit 1; if students did it, connect it to the computational thinking slides here. | Part | Topic | Time | | --- | --- | --- | | 1 | What is computer science? (CS vs. programming, computational thinking, fields of CS) | 20 min | | 2 | Abstraction (detail removal and generalization) | 25 min | | 3 | Binary, hex, and encoding (how colors and text are stored) | 1 period | | 4 | Programming languages ("roll a die" in five languages, the TIOBE Index) | 30 min | | 5 | Why we're learning Java, and why Processing | 20 min | Objectives: by the end, students can explain the difference between computer science and programming; name the four ideas of computational thinking; explain abstraction and binary encoding in their own words; compare how a few languages express the same program; read a language ranking critically; and give two reasons GP1 uses Java and Processing. Materials: none for Parts 1, 2, 4, and 5. Part 3 works well with paper for binary practice. Click-to-reveal: many lists in this deck appear one item per click, so you can ask before you show. That works in the HTML version (GitHub Pages, or the .html file in a browser). VS Code's preview, PDF, and PowerPoint show every item at once, so present from the HTML version. The notes on each of those slides say so, so nobody changes the * bullets back to -. Sources: Part 1's "Why study computer science?", "Computing in your future", and "Computing and society" slides, and all of Parts 2 and 3, are adapted from CSE 120: Computer Science Principles, Winter 2020, University of Washington (instructor Sam Wolfson), "L01: Intro, Abstraction" and "L03: Binary." UW course materials are not openly licensed, so this title slide credits the course; keep that line, since the deck is public on GitHub Pages. The rest of Part 1 and Parts 4 and 5 are new for GP1; their sources are in each slide's notes.
About 20 minutes. Three slides here (Why study computer science?, Computing in your future, Computing and society) are adapted from "L01: Intro, Abstraction," CSE 120, Winter 2020, University of Washington; the rest are new for GP1.
Even if it's not your focus, it has a massive impact on society. It also tends to be useful for lots of different fields. Activity: break into groups. Each group lists careers they think don't involve any computing. Then share out, and the class tries to find the computing in each one (farming: GPS tractors and weather data; hair stylist: online booking and social media; and so on). Click to reveal: these bullets start with * instead of - on purpose, so they appear one per click in the HTML version.
Before showing the bullets, ask: "What do you think computer science is?" Write answers on the board. Common ones: coding, fixing computers, hacking, making games, AI. Point to land: all of those use CS, but CS itself is about problems and how to solve them. Coding is one part of it. Click to reveal: these bullets start with * instead of - on purpose, so they appear one per click in the HTML version.
Programming is a way to express computational thinking, but it's not the most important part of computer science. Once you know what you're trying to solve, the details of a specific language matter less (Part 4 shows this with the same program in five languages). Computational thinking might feel strange at first, but it's not impossible. It's just another skill to learn. Adapted from "L01: Intro, Abstraction," CSE 120, Winter 2020, University of Washington. Click to reveal: these bullets start with * instead of - on purpose, so they appear one per click in the HTML version.
Discussion: "What would a chef's 'telescope' be? A musician's?" (Knives and a stove; an instrument.) The tool matters, but it isn't the subject. Source caveat: this quote is usually credited to Edsger Dijkstra, a famous Dutch computer scientist, but there's no record of him writing it. It may come from computer scientists Michael Fellows and Ian Parberry (1993). Say "often credited to Dijkstra" if you name anyone.
These four ideas are a common way to describe computational thinking in K-12 CS (for example, BBC Bitesize and Google's Computational Thinking resources). Jeannette Wing popularized the term "computational thinking" in a 2006 essay. Ask students to try it on another game they know: "Decompose Tetris." (Falling piece, the grid, clearing lines, the score, speeding up.) Coming up: Part 2 goes deeper on abstraction. Algorithms get their own deck, Algorithms (algorithms.md).
CS is a big field with many specialties, and games touch almost all of them. Ask: "Which of these sounds most interesting to you?" Quick hands or a sticky-note poll. Careers connection: game studios hire graphics programmers, AI programmers, network engineers, security teams, data analysts, and UX designers, not just "game programmers."
I will try to convince you that computing is inescapable (unless you want to live in the woods, but even then...). Whether or not this is a good thing is its own topic. Computing is important for every job: creating and processing data. We don't have time to make you super skilled programmers, but we do want you to have a sense of how CS affects you and how you can actively understand it, even if you never take another CS course. Some of you will decide you want to continue with CS, and that's great! Some of you won't, and that's fine too. But you'll make an informed decision. Click to reveal: these bullets start with * instead of - on purpose, so they appear one per click in the HTML version.
How has computing affected our society? After each line, ask what it shows: - Working from home: computing enabled it, for better or worse. When are you really "off the clock"? - Online "stalking": have you looked up info about someone instead of asking them directly? Employers do this too. - Emoji: a whole new way to communicate and express emotions. - Pokémon GO: interaction between the digital and physical world. Does anyone have a newer example? - Identity theft: new ways to enable theft. - Devices for kids: changes how we interact with children and raise them. Lots of ways they interact! For high schoolers, you might swap in TikTok, group chats, or AI chatbots for homework. Click to reveal: these bullets start with * instead of - on purpose, so they appear one per click in the HTML version.
Abstraction is somewhat difficult to describe. Has anyone heard of it or used it some way before? A research paper starts with an abstract (a short summary). So, what is the goal of abstraction?
...to deal with complexity. If you just want to draw a few things, it's fairly straightforward. But as it gets more complex, there's a lot more "stuff" you need to deal with. - Detail removal: only expose the parts that are necessary for the task at hand. - Generalization: don't reinvent the wheel; apply existing tools to similar but new problems. What is the most appropriate abstraction that lets you solve a problem? We'll start with detail removal. Game connection for GP1: a board game piece is an abstraction too. A chess knight doesn't need a horse's legs, just a shape and a move rule. Click to reveal: these bullets start with * instead of - on purpose, so they appear one per click in the HTML version.
Read out the quote. Then ask: what is missing from each of these examples? 1. Matisse: missing features. How can you tell it's a person? It has legs, a head, etc., even though it's missing the details a real person would have. Artwork: Henri Matisse, Blue Nude IV (Nu bleu IV), 1952, gouache-painted paper cut-outs, Musée Matisse, Nice. Still under copyright in the US; used here for classroom teaching.
2. The detailed map is missing trees, buildings, people, etc. They aren't needed for its purpose. 3. The simpler map is missing the small streets. If Google Maps is down, how much detail can we remove and still solve the problem? You don't even need most of the streets.
The user interface stays the same even as the underlying technology changes: pedals and steering wheel, shape and position are generally the same. You don't need to know what's going on under the hood as long as you understand the interface; it's all abstracted away! Nowadays the pedals don't even directly control the systems; they just send a signal to a computer. Game connection: a game controller works the same way. "A" means jump in many games, no matter how each game makes jumping happen. Click to reveal: these bullets start with * instead of - on purpose, so they appear one per click in the HTML version.
Detail removal also applies to how the car is designed. The people who design the accelerator pedal don't even need to know the people who design the part that actually sends fuel to the engine. There's an "abstraction barrier" between the accelerator and the throttle body; neither needs to understand the other's details.
The ECM serves as an "abstraction barrier" between the accelerator and the throttle. The designer of each part isn't concerned with how the others work, as long as it can send and receive data to and from them. Click to reveal: these bullets start with * instead of - on purpose, so they appear one per click in the HTML version.
Read the quote. - Shower rods: not every bathroom is the same size, but instead of building a rod for every bathroom, make one that extends. Same for hats and belts. - Recipes: you can substitute an ingredient like the fruit while keeping most of the recipe the same. - Feeding animals: just substitute the animal's name for each food type. One generalizable solution for all situations. This is exactly what a variable or a function does in code. Click to reveal: these bullets start with * instead of - on purpose, so they appear one per click in the HTML version.
Collect answers on the board. Examples students (and past classes) have come up with: Detail removal: - Flying an airplane (autopilot) - Using a computer (press a button) - Light switches - A painting; an abstract (short summary) of a paper Generalization: - Writing a formula you can reuse - Clothing sizes (S/M/L) instead of exact measurements; a onesie (less clothing to deal with) - IKEA furniture - Sorting food into food groups
Wrap-up. Ask for a show of hands on each question. Land the point: you can use a computer without knowing how it works because of abstraction, and in this course you'll learn to build your own abstractions in code. Click to reveal: the bullets start with * instead of - on purpose, so they appear one per click in the HTML version, with "Thanks to abstraction!!!" last. Get the show of hands on each question before you click.
Source for Part 3: "L03: Binary," CSE 120, Winter 2020, University of Washington. Why this matters for GP1: every color you pick in Processing is three numbers from 0 to 255, and many old games have stats that max out at 255. Both come from binary.
As humans, we use the decimal numbering system. Why? Hard to say. Maybe because we have 10 fingers? For 0-9, we use one digit. To make larger numbers, we combine digits. Write the place values over the example: ones digit, tens digit, hundreds digit, and so on. Each place is the base raised to the power of its position (10^0, 10^1, ...). The original deck also had a slide on octal (base 8) using four-fingered cartoon hands. It's skipped here; mention it if students ask "why base 10?"
Computers typically use binary and hexadecimal. Binary is just base 2: we only have 0 and 1! You can write a subscript 2, or the prefix "0b" ("zero bee"); they mean the same thing. Same procedure as decimal to convert, but now the places are 1's, 2's, 4's, 8's... Hexadecimal is also often used with computers. Ask: where can we get the extra symbols we need past 9? Letters: 10 is A, 11 is B, and so on up to 15 = F. The prefix is "0x" ("zero ex"). With A in the 16's position, it means 10 x 16. Powers of 2 to keep on the board: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024. Click to reveal: the answer lines start with * instead of - on purpose, so each one appears on its own click in the HTML version. Give students a moment to work out each example before you click.
Bi-stable: having two stable states (i.e., "on" and "off"). Point at the graph: the signal wobbles, but as long as it stays in the low gray band it's a 0, and in the high band it's a 1. Two wide bands are much easier to tell apart than ten narrow ones. DNA bases: adenine (A), cytosine (C), guanine (G), thymine (T).
Each row is the same value written three different ways. Point out that one hex digit always matches exactly four binary digits; that's why programmers like hex.
Warm-up: with N decimal digits, how many things can you represent? (1 digit: 10, 2 digits: 100, N digits: 10^N.) Same idea in binary: 2^N. Some people spell it "nybble." Click to reveal: the answer lines start with * instead of - on purpose, so each one appears on its own click in the HTML version. Ask the question first.
As long as we agree on a translation from the number to what it represents, we can use numbers for (nearly) anything! "Let's agree that the happy face is 0," and so on. Base 2 is too hard for humans to read, so we use base 16 as a convenient way to hold what is really binary data in our heads. 0x4E6F21: as a decimal number it's 5,140,257; as ASCII text it's "No!"; as an RGB color it's a dark green (red 0x4E = 78, green 0x6F = 111, blue 0x21 = 33). The original slide used that green as its background. Numbers aren't useful without context.
Each of red, green, and blue gets a number from 0 to 255 for how much of that color we have. Why 255? It's the largest number that fits in 8 bits (2^8 = 256 values, 0-255). This is exactly how color works in Processing (Processing Intro deck, Part 4: Colors): fill(128, 0, 0) is the same maroon as #800000 (0x80 = 128), and fill(255, 215, 0) is the same gold as #FFD700. Processing's color selector shows both. Maroon and gold are Lindblom's colors. These hex values are the standard web colors named "maroon" and "gold"; the school doesn't publish official hex codes, so ask students to sample the exact shades from the Lindblom eagle logo with Processing's color selector or an eyedropper tool.
Write "yay" → 0x796179 on the board: it's text only if we tell the computer to interpret it as text. Modern computers use Unicode (UTF-8), which starts with the same 128 ASCII codes and adds every other writing system and emoji.
255 is the max number stored in a byte. Pac-Man (1980): the level counter is stored in one byte. On level 256 it rolls over to 0, and the code that draws the fruit at the bottom of the screen runs wild and garbles the right half of the maze. The game can't be finished. Final Fantasy VII: most stats cap at 255. The Legend of Zelda (NES): rupees max out at 255. Video: Numberphile, "255," http://www.numberphile.com/videos/255.html GP1 connection: if you store a score in a byte-sized variable, you'll hit the same wall. In Processing, int goes up to about 2.1 billion, so you're safe.
Computer memory demo: open an image in a hex viewer (in vim: %!xxd; online hex viewers work too). Every JPEG starts with the bytes FF D8 FF. The image viewer knows to interpret these bits as a picture; a text editor shows garbage. This connects back to Part 2: layers of abstraction let us think "picture" instead of "millions of bits." Click to reveal: these bullets start with * instead of - on purpose, so they appear one per click in the HTML version.
End on the joke and ask who gets it: 10 in binary is 2. Click to reveal: these bullets start with * instead of - on purpose, so they appear one per click in the HTML version.
Part 4 is new for GP1. About 30 minutes. Big idea: there are hundreds of programming languages, but they share the same ideas (variables, decisions, loops, functions). Learn one well and the next is much easier.
Connect to Part 3: the CPU only understands 1s and 0s, so every language needs a translator. If students ask how the translation works: some languages are compiled ahead of time (C++ into machine code; Java into "bytecode" that runs on the Java Virtual Machine), and some are interpreted while they run (Python, and JavaScript in the browser). No need to go deeper today. Click to reveal: these bullets start with * instead of - on purpose, so they appear one per click in the HTML version.
Same program, three languages: pick a random number from 1 to 6, store it, and show it. Ask students to find the three steps in each version. Then ask: "What's different?" (How you get a random number, how you print, whether lines end in semicolons, how text is joined: a comma, +, or ..)
The same three steps, but Java asks for more structure: every program lives in a class, it starts in main(), and you say what type each variable is (int roll). That extra structure feels like a lot at first, but it's also why Java catches many mistakes before the program even runs. Part 5 comes back to this, and shows how Processing hides most of this setup. rng.nextInt(6) gives a number from 0 to 5, so we add 1.
C++ powers most big console and PC games (Unreal Engine is written in C++). It looks a lot like Java: braces, semicolons, int, and main(). std::srand(std::time(nullptr)) seeds the random numbers with the current time so you get a different roll each run. % 6 gives a remainder from 0 to 5, so we add 1. (Modern C++ has a better random library, <random>, but this version is shorter to read.)
Point to land: the algorithm didn't change; only the syntax (the "spelling") did. That's why CS is not the same as programming: the thinking carries over from language to language.
Ask: "Which games on this list have you played?" Most students have played something built with each. Notes: Unity scripts are written in C#. Unreal is C++ (plus a visual scripting system called Blueprints). Roblox uses Luau, a faster version of Lua. Godot also supports C#. Minecraft: Java Edition is the original PC version; Bedrock Edition (consoles, phones, Windows) is C++.
A very common mix-up, even among adults. Java came from James Gosling's team at Sun Microsystems. JavaScript was created by Brendan Eich at Netscape in 1995, first called Mocha and then LiveScript, and renamed to ride on Java's popularity. The car/carpet line is a well-known joke among programmers; its original author is unknown. Click to reveal: these bullets start with * instead of - on purpose, so they appear one per click in the HTML version.
TIOBE is a Dutch software-quality company that has published the index every month since 2001. It counts search results for "<language> programming" across many search engines and websites. Discussion: "Does more search results mean a language is better? What else could cause lots of searches?" (A language could be popular with beginners who search a lot, or confusing enough that people look things up often.) Source: TIOBE Index, https://www.tiobe.com/tiobe-index/ Click to reveal: these bullets start with * instead of - on purpose, so they appear one per click in the HTML version.
The numbers are TIOBE's October 2026 index, copied from tiobe.com. The top 7 are in the same order as a year ago. The movers: R climbed from #13 to #8, SQL from #10 to #9, and Rust from #16 to #10. Go dropped out of the top 10, to #11 (1.39%). Discussion: "Python is about 19%, and #10 is under 1.5%. What does that tell you?" (A few languages get most of the attention, and hundreds more share the rest.) Ask which languages on the list students have heard of, and which ones show up on the "Which language makes which games?" slide. Caveat: TIOBE changed its method in 2026 (it added Mandarin Chinese search terms), so some big jumps this year may come from the method, not real changes in interest. Update this table each school year. Point out that Java has been near the top since the index began. Sources: TIOBE Index, October 2026 (https://www.tiobe.com/tiobe-index/); TechRepublic, "TIOBE Index October 2026."
Each ranking measures something different: what people search for, what developers say they use at work, or what people write on GitHub. TypeScript is JavaScript with types added, so it's a close cousin. Point to land: before you trust a ranking, ask what it counted. Sources: Stack Overflow Developer Survey (survey.stackoverflow.co); GitHub Octoverse 2025 (github.blog/news-insights/octoverse/). Check the newest editions each year; the order changes. Click to reveal: these bullets start with * instead of - on purpose, so they appear one per click in the HTML version.
Part 5 is new for GP1. About 20 minutes. Goal: students should leave able to give two reasons we use Java and Processing in GP1.
Java was designed so one program could run on any kind of computer without being rewritten. The Java Virtual Machine (JVM) is the translator on each computer that makes that work. Oracle bought Sun Microsystems in 2010, so Oracle now develops Java. Source: Oracle, "The History of Java Technology" (oracle.com/java). Click to reveal: these bullets start with * instead of - on purpose, so they appear one per click in the HTML version.
For LMSA students, the AP CS A connection is a big one: what they learn in GP1 is a head start on that course and exam. Android: Google has recommended Kotlin for new Android apps since 2019, but Kotlin runs on the same system as Java and many apps are still written in Java. Types: Java makes you say what kind of data each variable holds. It feels strict at first, but it catches mistakes before the program runs. Sources: College Board, AP Computer Science A course page (apcentral.collegeboard.org); Android Developers, "Kotlin-first" (developer.android.com). Click to reveal: these bullets start with * instead of - on purpose, so they appear one per click in the HTML version.
Point out the braces, parentheses, and semicolons: Java, C#, C++, and JavaScript all come from the same "C family." Learning Java means Unity (C#), Unreal (C++), and the web (JavaScript) will look familiar. JavaScript's === means "equal and the same type"; == also exists but has surprises. Python uses indentation instead of braces.
Processing hides the setup that plain Java needs (the class and main() from the "Roll a die: Java" slide), so the same program is 2 lines instead of 8. It's still Java underneath, so everything carries over. random(1, 7) gives a decimal from 1 up to (not including) 7, and int() chops off the decimal, giving 1 to 6. Source: Processing Foundation, processing.org/overview.
We'll use Processing for this course. Its syntax is based on Java, but we're mainly using it because it's designed to create visual and interactive programs. Like I've been saying, the language doesn't really matter in general. Here are some cool things you'll be able to make! Both animations come from the UW course: a monster that follows the mouse, and a two-player tic-tac-toe game. Tic-tac-toe is a good preview of the board-game-to-digital projects later in GP1. Processing: https://processing.org/
Exit ticket (pick two): 1. In one sentence, what's the difference between computer science and programming? 2. Name a programming language and one thing built with it. 3. Give one reason we're learning Java. 4. Why might the TIOBE Index and the Stack Overflow survey rank languages differently? Click to reveal: these bullets start with * instead of - on purpose, so they appear one per click in the HTML version.
Next deck: processing-intro.md in this folder. Students need Processing installed (https://processing.org/download; may need IT).