Lesson 2 of 5 · ⏱ 10 min

Algorithms & Flowcharts

Before you write code, you plan. An algorithm is just a clear plan — and every great game starts with one.

An algorithm is a fancy word for a simple idea: a step-by-step plan to get something done. You already use algorithms every day. Making a sandwich is an algorithm. So is brushing your teeth, or getting ready for school. A programmer just writes these plans down so a computer can follow them.

Order matters — a lot

Because a computer follows steps exactly and in order, the order is everything. Look at this plan to make tea:

⚠️
1. Pour the tea into the cup.  2. Boil the water.  3. Add the tea leaves.

Something’s wrong! You poured before boiling. The computer would never fix this for you — it just does step 1, then 2, then 3, and ends up with a mess. Right order = right result.

The correct algorithm is: boil the water → add the tea leaves → wait → pour into the cup. Same steps, sensible order. This is exactly how game code works too: draw the background before the player, or the player gets hidden behind it.

Pseudocode: plain-English code

Pseudocode means writing your plan in plain language that looks like code, before writing the real thing. It helps you think without worrying about exact spelling. Here’s the plan for a simple coin-collecting game:

💡
WHEN the game starts: set score to 0
EVERY frame:
  IF the player touches a coin:
    add 1 to score
    remove the coin
  draw the player and the score

Notice you can understand that even without knowing how to code yet. That’s the point — get the thinking right first, and the code becomes easy.

Flowcharts: drawing the plan

A flowchart is a picture of an algorithm. We use a few standard shapes so everyone reads them the same way:

Start / EndDo a stepDecision?Arrow = "next"
The four shapes you’ll use most in flowcharts.

An oval starts or ends the plan. A rectangle is a step (“move the player”). A diamond asks a yes/no question (“is the score 10?”) and the plan branches based on the answer. Arrows show what happens next.

See an algorithm run, in order

Let’s prove that order matters. The code below draws a scene in three steps — sky, then sun, then ground — exactly in the order written. Run it. Then try swapping the order of the blocks and see how the picture changes.

🎮 Try it yourselfThree steps, in order

Each block is one step of the algorithm. Press Run. Then move the “ground” block to the top and run again — watch the sky paint over your ground, because the computer obeys the new order.

Open in the full Game Lab ↗
✓ Check yourselfWhy did putting the “ground” step first hide it?

💪 Practice — 10 questions

Answer these to lock in the lesson. Every answer counts toward your progress.

Q1An algorithm is…
Q2Why does the order of steps matter so much?
Q3Pseudocode is…
Q4In a flowchart, an oval means…
Q5In a flowchart, a rectangle means…
Q6In a flowchart, a diamond means…
Q7What do the arrows in a flowchart show?
Q8When drawing a scene, you should draw the background…
Q9Which is an everyday algorithm?
Q10Planning before you code helps you…
📝 Ready? Take the online test

10 questions, auto-graded. Your score is saved to your dashboard and counts toward your phase certificate.

Start the test →

Key takeaways

  • An algorithm is a clear, step-by-step plan to get something done.
  • Computers follow steps exactly and in order, so the order changes the result.
  • Pseudocode is plain-English code that helps you plan before coding.
  • Flowcharts draw a plan with ovals (start/end), rectangles (steps), diamonds (decisions) and arrows.
📘 Reference summary

Programming starts with a plan. An algorithm is a step-by-step plan; order matters because computers obey exactly and in sequence. Pseudocode and flowcharts help you design the plan before writing real code — including the rule that you draw backgrounds before the things on top.