Back

Build 1: Your First Project

divider

The Brief

Two sessions. You choose what to make. A console program or a Raylib program — your call.

Every activity so far has told you what to build. This one does not. Quarter 1 gave you input, arrays, decisions, and loops, and Activities 2.1 through 2.4 added methods with parameters. That is the complete set of ingredients the Create task asks for, so this is the first point in the course where a real project of your own is possible.

The scope rule: a person could use the finished thing in under two minutes. This is a rule, not a suggestion. A plan that breaks it does not get approved.

The worked examples on this page are taken. The Study Break Picker and the Night Sky exist to show you the shape and the size of a good project. Build something else.

No video. No written reference. Those belong to Build 2 and to the Create task. This one is just the program.

divider

Build 1

Your First Project

Key Concepts

Scoping a Project

The Four Requirements

The One That Fails Silently

The Scoping Gate

Every Program So Far Was Somebody Else's Idea

Dragon Duel in Activity 2.3 and the skyline in Activity 2.4 came with their tasks written out. You filled in the parts, but the decision about what to build had already been made for you.

The Create task in Quarter 3 has no task list. You decide what the program is, and you decide how much of it you can finish in the time you have. That second decision is the one students get wrong, and it is what the next two sessions are for.

You Already Have Every Ingredient

Quarter 1 gave you input with Console.ReadLine and Raylib's key checks, arrays, if, and loops. Activities 2.1 through 2.4 added methods, parameters, and return values.

That is every ingredient the Create task asks for. Nothing new is taught today. The skill being practiced is choosing a program small enough to finish and putting the right parts in the right places.

Four Requirements, in the Create Task's Own Words

  1. Input — your program asks for something and uses the answer
  2. A list your program actually needs — in C#, an array
  3. A procedure you wrote — in C#, a method — with a parameter that changes what it does
  4. Sequencing, selection, and iteration inside that method

The Create task's requirements are worded around the exam, which says list and procedure. In C# those are your array and your method.

Read Number Four Again

It does not say your program needs a loop and an if somewhere.

It says they have to be inside the body of the method you wrote, between its own two braces, alongside statements that run in order.

This is the requirement people lose points on without ever noticing, because a program can run perfectly and still miss it.

All the Parts, in the Wrong Place

Here is the top of a small break picker: two arrays that line up by position, and a number typed in by the user.

Demo
string[] breaks = { "Stretch", "Walk outside", "Power nap" };
int[] minutes = { 5, 15, 25 };
Console.Write("How many minutes do you have? ");
int free = int.Parse(Console.ReadLine());

The rest of it, on the next slide, has a loop, an if, and a method whose parameter changes what it prints. Decide before its output appears: does it meet requirement 4?

All the Parts, in the Wrong Place

Demo
for (int i = 0; i < breaks.Length; i++)
{
if (minutes[i] <= free)
{
Suggest(breaks[i]);
}
}
void Suggest(string name)
{
Console.WriteLine($"You could: {name}");
}
Output
How many minutes do you have? 20
You could: Stretch
You could: Walk outside

All the Parts, in the Wrong Place

It runs, and the output is right. It still fails requirement 4.

The loop and the if are in the main program. Between Suggest's braces there is exactly one line, and it is neither a loop nor a decision. The main program does not count as yours, so its loop and its if earn nothing.

Try it with 3, too: it prints nothing at all, not even a message saying nothing fits. Nobody told the program what to do when no break fits.

Move the Loop In, and It Passes

The fix does not add a feature. It moves the loop and the if inside the method, and passes the number the user typed in as the parameter. The two arrays and the input line at the top stay exactly as they were, and the main program now ends with one call:

Demo
Suggest(free);

On the next slide is the new method. Predict what the program prints when the user types 5.

Move the Loop In, and It Passes

Demo
void Suggest(int limit)
{
Console.WriteLine($"With {limit} minutes:");
for (int i = 0; i < breaks.Length; i++)
{
if (minutes[i] <= limit)
{
Console.WriteLine($" You could: {breaks[i]}");
}
}
}
Output
How many minutes do you have? 5
With 5 minutes:
You could: Stretch

Move the Loop In, and It Passes

Only Stretch takes 5 minutes or less. Now find Suggest's opening brace and its closing brace. Between them: a heading that just runs (sequencing), a for loop over the arrays (iteration), and an if (selection).

And limit drives all of it. Call Suggest(5) and one break prints; call Suggest(20) and two do. That is a parameter that changes what the method does.

Type 3, though, and you get the heading and nothing under it. The version further down this page adds a counter so it can say “Nothing fits.”

In Raylib, the Main Loop Is Not Yours Either

Activity 2.4 said it: Raylib.DrawCircle is a built-in method, and your main program is a main method. The College Board counts neither as student-developed.

That includes the while loop that keeps the window open and the IsKeyPressed checks inside it. A Raylib program is full of loops and decisions that do not count, because they live in the main program.

You need a method of your own, called from the main loop, with its own loop and its own if inside it.

The Scope Rule

Someone could use the finished thing in under two minutes.

Not “it takes two minutes to write.” Two minutes to use: sit down, run it, try it, and get the point of it.

A program that small still holds all four requirements. The ideas further down this page are all that size, on purpose.

Bad Scoping Is Learned by Doing It Wrong

Planning more than you can finish is the most common way the Create task goes wrong. Nobody gets better at it by being told; you get better by planning something, building it, and seeing how far you actually got.

So we are going to get it wrong here, where it costs two sessions, instead of in Quarter 3, where it costs eight and the score counts toward the exam.

A Good Idea Can Still Be a Bad Plan

Here is a plan a student might hand in. The idea is genuinely useful. Read it and find the steps you could not build with what you know.

Study Planner
Program: Study Planner
What it does: keeps track of all my classes and
assignments and tells me what to work on.
1. Let the user add a class.
2. Let the user add an assignment with a due date.
3. Save everything so it is still there tomorrow.
4. Show a calendar for the week.
5. Sort the assignments by how urgent they are.
6. Let the user check things off.

A Good Idea Can Still Be a Bad Plan

Step 3 is impossible with anything taught so far — saving data so it is there tomorrow means writing to a file.

Steps 1, 2, and 6 each need their own loop of questions, and step 5 is a sorting algorithm. An array also cannot grow when the user adds a class.

And nobody uses it in under two minutes: typing in your classes alone takes longer than that.

The giveaway: it never names an array, a method, or a parameter. A plan that cannot name those is not finished, however good the idea is.

An Approved Plan Names Its Parts

This is the Study Break Picker, planned in prose pseudocode: numbered plain-English steps, detailed enough that someone else could write the program from them.

As you read it, look for the four requirements. Every one of them is named somewhere in the steps.

An Approved Plan Names Its Parts

Study Break Picker
Program: Study Break Picker
What it does: you say how many minutes you have,
and it prints the breaks that fit.
1. Make an array called breaks holding break names.
2. Make an array called minutes holding how long each
one takes, in the same order.
3. Write a method FitsIn(limit):
a. Print a heading that includes limit.
b. Set a counter called found to 0.
c. Loop over every position in the two arrays.
i. If the minutes at that position are less than
or equal to limit, print the name and the
minutes, and add 1 to found.
d. If found is still 0, print "Nothing fits."
4. Ask the user how many minutes they have.
5. Call FitsIn with that number.

An Approved Plan Names Its Parts

Step 3 names the method and its parameter. Inside it, steps a and b just run, step c is the loop, and the two “if”s are the decisions.

All four requirements are visible before a single line of C# exists. That is exactly what the gate checks for. It is also practice for the exam's written response, which asks you to explain your own program's algorithm in steps like these.

Today: Plan First, Then Build

Twenty minutes: write your plan on the sheet, in prose pseudocode, naming your input, your array, your method, and its parameter.

No code until it is approved. If your plan comes back as too big, that is the gate doing its job, and it is far cheaper now than halfway through the build.

Once it is approved, build.

Next Session, Your Plan Gets Read Out Loud

You build for most of the period. In the last fifteen minutes, everyone reads today's plan aloud, exactly as written, and says what actually happened to it.

Most plans will turn out to have been too big. That is the result this build is designed to produce. Build 2 asks you to plan a four-session project, and what you find out tomorrow is what you will be held to when you do.

Key Terms

Scope
How much a project is trying to do.
Prose pseudocode
Numbered plain-English steps, detailed enough that someone else could write the code from them.
Scoping gate
The check a plan has to pass before any code is written.
Student-developed procedure
A procedure you wrote yourself; built-in methods and the main program do not count.

'F' → Fullscreen

divider

The Four Requirements

These are four of the six requirements the Create task will ask for in Quarter 3, in the same words. The Create task is written for every language, so it says list where C# has an array and procedure where C# has a method.

  1. Input. Your program asks for something and uses the answer. In the console that is Console.ReadLine(), usually inside int.Parse. In Raylib it is a key check such as Raylib.IsKeyPressed(KeyboardKey.Space), the way Raylib Labs 3 through 6 used them.
  2. An array your program actually needs. Not an array you added so there would be one. The test: if you deleted it, would the program break? If not, it does not count.
  3. A method you wrote, with a parameter that changes what it does. The test: pass a different argument, and something different should happen. If you have to edit the method's body to get a different result, the parameter is decorative.
  4. Sequencing, selection, and iteration inside that method's body. Statements that run in order, an if, and a loop — all three between that method's own braces.

Two more come almost free once you have those four. Your method gets called — and if it does not, C# warns you with CS8321: The local function 'Suggest' is declared but never used, the warning from Activity 2.1. And your program produces output based on the input. Check both anyway.

divider

The One That Fails Silently

Requirement 4 is the only one you can appear to satisfy and still lose the point. Here is the deck's break picker again. It has input, two arrays, a loop, an if, and a method with a parameter, and it runs:

Everything in the program, in the wrong place
string[] breaks = { "Stretch", "Walk outside", "Power nap" };
int[] minutes = { 5, 15, 25 };
Console.Write("How many minutes do you have? ");
int free = int.Parse(Console.ReadLine());
for (int i = 0; i < breaks.Length; i++)
{
if (minutes[i] <= free)
{
Suggest(breaks[i]);
}
}
void Suggest(string name)
{
Console.WriteLine($"You could: {name}");
}
Output
How many minutes do you have? 20
You could: Stretch
You could: Walk outside

It still fails requirement 4, because the loop and the if are in the main program, outside Suggest. Between that method's braces there is one line, and it is neither. The main program is a main method, which the College Board does not count as yours, so the loop and the if there earn nothing.


And here is the version that passes

The fix is not to add anything. It is to move the loop and the if inside the method and pass the user's number in as the parameter.

All three, inside one method
string[] breaks = { "Stretch", "Walk outside", "Power nap" };
int[] minutes = { 5, 15, 25 };
Console.Write("How many minutes do you have? ");
int free = int.Parse(Console.ReadLine());
Suggest(free);
void Suggest(int limit)
{
Console.WriteLine($"With {limit} minutes:");
int found = 0;
for (int i = 0; i < breaks.Length; i++)
{
if (minutes[i] <= limit)
{
Console.WriteLine($" You could: {breaks[i]}");
found = found + 1;
}
}
if (found == 0)
{
Console.WriteLine(" Nothing fits.");
}
}
Output
How many minutes do you have? 20
With 20 minutes:
You could: Stretch
You could: Walk outside
Output
How many minutes do you have? 3
With 3 minutes:
Nothing fits.

Inside Suggest now: a heading and a counter that just run (sequencing), a for loop (iteration), and two ifs (selection). The counter is doing real work, too. It is what lets the second if say “Nothing fits” when the user types 3, where the first version printed nothing at all.


If you build in Raylib

Raylib makes requirement 4 easier to miss, because a Raylib program is already full of loops and decisions. The while loop that keeps the window open and the key checks inside it are all part of the main program, and none of them count. Your own method needs its own loop and its own if.

Here is the shape, from a small program that draws a sky of stars and lets the Up and Down keys decide how many shine. The bodies are left out on purpose.

The main loop calls DrawSky; DrawSky holds the loop and the if
while (!Raylib.WindowShouldClose())
{
// Up and Down change shining. That is the input,
// and it belongs to the main program.
Raylib.BeginDrawing();
Raylib.ClearBackground(Color.Black);
DrawSky(shining);
Raylib.EndDrawing();
}
Raylib.CloseWindow();
void DrawSky(int count)
{
Raylib.DrawText($"{count} stars shining", 20, 410, 20, Color.Gray);
for (int i = 0; i < starX.Length; i++)
{
if (i < count)
{
// ... a bright star at starX[i], starY[i]
}
else
{
// ... a dim one
}
}
}

count decides how many stars are bright, so it changes what the method draws. Between DrawSky's braces there is a line that just runs, a loop over the star arrays, and a decision. That is requirement 4 in Raylib.


Before you submit, do this one check. Find your method. Put your finger on its opening brace and its closing brace. Between those two marks, can you point at a statement that just runs, a loop, and an if? If not, restructure now — it is much cheaper today than it will be in Quarter 3.

divider

Ideas

You do not have to use one of these. They exist to show the size we are aiming for, and every one can be built with arrays and the tools you already have.

Console

  • Movie picker. You say how many minutes you have; it prints the films from an array that fit.
  • Packing list. You say how many days the trip is; it prints what to bring and how many of each.
  • Five-question quiz. Questions and answers in two arrays, asked one at a time, scored at the end. The parameter could be how many questions to ask.
  • Playlist filter. Songs in one array and a mood for each in another; you pick a mood, it prints the matches.
  • Team splitter. An array of names and a number of teams; it deals the names out. % from Activity 1.6 does the dealing.
  • Locker assigner. An array of names and an array of which lockers are broken; it prints who gets which locker, skipping the broken ones.

Raylib

  • Paint swatches. A row of colors from an array; Left and Right move a highlight from one to the next, and the method draws every swatch, outlining the chosen one.
  • Equalizer. An array of bar heights; Up and Down change how loud it is, and the method draws every bar, coloring the ones over a limit red.
  • Traffic grid. Arrays of car positions on a road; Space advances time, and the method draws the cars, stopping any that reach the red light.
  • Target gallery. Arrays of target positions and a bool array of which are hit, like Raylib Lab 6's invaders; the method draws only the targets still standing.

Every one of these passes the two-minute rule, and every one of them has an obvious array and an obvious method. That is not an accident — it is what a well-scoped project looks like.

Choosing Raylib means finishing in class. Juicemind runs console programs only, so a Raylib project cannot be worked on at home. One more reason to keep it small.

divider

Session 35: The Scoping Gate

Twenty minutes, and no code until your plan is approved.

Write your plan on the sheet in prose pseudocode — numbered plain-English steps, detailed enough that someone else could write the program from them. Not C#, and not exam notation either. Plain sentences, in order.

What to hand me
Program: <name>
What it does: <one sentence>
Input: <what you ask for, or which keys>
Array: <its name, and what is in it>
Method: <its name, and its parameter>
Inside it: <the loop, and the decision>
Steps:
1. ...
2. ...

A plan that gets approved

Study Break Picker
Program: Study Break Picker
What it does: you say how many minutes you have,
and it prints the breaks that fit.
1. Make an array called breaks holding break names.
2. Make an array called minutes holding how long each
one takes, in the same order.
3. Write a method FitsIn(limit):
a. Print a heading that includes limit.
b. Set a counter called found to 0.
c. Loop over every position in the two arrays.
i. If the minutes at that position are less than
or equal to limit, print the name and the
minutes, and add 1 to found.
d. If found is still 0, print "Nothing fits."
4. Ask the user how many minutes they have.
5. Call FitsIn with that number.

Read step 3 again. The method has a parameter, and inside its body there is a heading and a counter (sequencing), a loop over the arrays (iteration), and two decisions (selection). All four requirements are visible in the plan, before a single line is written. That is what the gate is checking for.

A plan that does not

Study Planner
Program: Study Planner
What it does: keeps track of all my classes and
assignments and tells me what to work on.
1. Let the user add a class.
2. Let the user add an assignment with a due date.
3. Save everything so it is still there tomorrow.
4. Show a calendar for the week.
5. Sort the assignments by how urgent they are.
6. Let the user check things off.

This is a good idea and a bad plan. Step 3 needs files, which nothing in the course has taught. Steps 1, 2, and 6 each need their own loop of questions, and an array cannot grow each time the user adds something. And nobody uses it in under two minutes — typing in your classes alone takes longer than that.

The giveaway is that it never names an array, a method, or a parameter. A plan that cannot name those is not finished, however good the idea is.

If your plan gets sent back, that is the system working. The whole reason Build 1 is two sessions long is so that finding this out is cheap.

divider

Session 36: Build, Then Share Out

Build for most of the session. Before the share-out, fill in the second half of your sheet. Then, in the last fifteen minutes:

  1. Read your session 35 plan out loud. The one you wrote, not a tidied version.
  2. Say what actually happened. What did you cut? What took longer than you thought? What turned out to be easy?

This is the point of Build 1. Most plans will have been too ambitious. Finding that out now, out loud, in a room where everyone else is finding out the same thing, is worth more than the program is. Session 45 asks you to scope a four-session project for Build 2, and this is the experience you will be held to when you do.

Unfinished at the end of the session? A console project can be finished at home in Juicemind. The rubric below does not care when it was finished — only that the requirements are there.

divider

Rubric

WhatPoints
Scoping plan written in prose pseudocode and approved at the gate8
Input — the program asks for something and uses the answer4
An array the program actually needs6
A method you wrote, with a parameter that changes what it does8
Sequencing, selection, and iteration inside that method's body8
Share-out — read your plan, said what actually happened6
Total40

Notice what is not on this list: how ambitious the idea was, and whether everything you planned got finished. A project that got cut in half and works loses nothing here.

divider

Submit

Three things go to the dropbox:

  1. Your sheet, including the session 35 plan exactly as you wrote it on the day.
  2. Your program file.
  3. One line naming your method and its parameter, so I know which one to check requirement 4 against.

Build Complete