Danfo Code

Coding & Logic Primary 3 to adults 10 chapters · 66 levels Free · No sign-up

Program a yellow Lagos danfo bus through city streets with tap-to-add code blocks. Pick up Mama Nkechi, Tunde, and Mr Bello, steer around roadworks, wait for zebra crossings and traffic lights, and handle rainy-season floods. Every level tests your route across multiple days—so loops and conditions feel necessary, not decorative. Includes pseudocode and WAEC flowchart views.

Play Danfo Code
Danfo Code cover: a yellow danfo bus on a grid road with code blocks above it and a bus stop sign

Quick facts

Subject
Computer Studies, Digital Technologies, Algorithms & Logic
Levels
Little Drivers (ages 4–7), Junior Coders (Primary 3–6), Code Captains (JSS 1–3), Route Masters (SSS 1–3, WAEC & adults)
Stages
10 chapters · 66 levels with 3-star efficiency targets
Help
Kola the conductor hints, step-by-step tracing, pseudocode & WAEC flowcharts, classroom mode, works offline
Controls
Touch-first: tap blocks to add (no dragging), keyboard shortcuts (F, L, R, P, D, G, S, Backspace)
Cost
Free forever · No sign-up · No ads · Privacy-first

How it plays

Unlike desktop block editors that require clumsy drag-and-drop, Danfo Code is built from the ground up for low-cost mobile phones (down to 360 px width):

  • Tap to build: tap a block in the bottom palette to insert it at your cursor. Tap any block in your program to move the cursor or open its options menu (change loop repetitions, switch conditions, add else branches, or delete).
  • Multi-day testing: a program must pass every day of a level. On Day 1 the light may be green, but on Day 2 it turns red; on Day 3 a passenger may shelter at a different stop. This proves why if and repeat until are essential.
  • Step-by-step tracing: press Step to execute one block at a time. The active block highlights as the bus moves, helping learners trace logic exactly like a teacher on a chalkboard.
  • Three-star par: finishing solves the level; using the fewest blocks earns three stars, rewarding clean, reusable loops and functions rather than brute force.

The 10 Chapters

  • Chapter 0: Little Drivers (Ages 4–7, Nursery–Primary 2): Large arrow cards (⬆, ⬇, ⬅, ➡), spoken guidance, auto pick-up, and gentle feedback without failure screens.
  • Chapter 1: First Trip (Sequence): Forward, Pick up, and Drop off. Teaching that instructions run in exact order.
  • Chapter 2: Left and Right (Turning): Turning left and right from the driver’s point of view, with steering hints and preview markers.
  • Chapter 3: Round and Round (Loops): Count-controlled Repeat N loops, saving blocks along Third Mainland Bridge and stair-step streets. Nested loops for squares.
  • Chapter 4: Fix the Route (Debugging): Starting with broken code. Tracing errors, finding the first failing step, and fixing it in minimal edits.
  • Chapter 5: Red Light, Green Light (Conditions): If, Else, Wait, and Repeat until for traffic lights and zebra crossings across changing days.
  • Chapter 6: Rainy Season (Conditions + Loops): Flooded Lagos streets, moving bus stops, and dynamic passenger locations across 3 test days.
  • Chapter 7: Named Routes (Functions): Defining and calling modular procedures (Route A and Route B), spotting repeating patterns and nesting calls.
  • Chapter 8: Fares and Fuel (Variables): Number parameters Route A(n), tracking collected fares, empty passenger seats, and fuel refilling with While loops.
  • Chapter 9: Rush Hour (Efficiency & Flowcharts): Complex multi-day grids with one-way streets. Converting solutions into standard pseudocode and flowchart diagrams.

Curriculum alignment (NERDC & WAEC)

Danfo Code directly supports UN Sustainable Development Goal 4 (Quality Education, Target 4.4: Relevant skills for digital confidence and problem solving):

  • Primary 4–6 Basic Science & Technology (Computer / Digital Literacy): Following and constructing ordered instructions, problem decomposition, and "what is a computer program?"
  • JSS 1–3 Digital Technologies / Computer Studies: Algorithm construction, sequence, selection (conditions), repetition (loops), and debugging techniques.
  • SSS 1–3 Computer Studies (WAEC / NECO): Algorithms, pseudocode conventions (BEGIN, IF...THEN...ELSE, REPEAT...UNTIL, WHILE...DO, END), and standard flowchart symbols (terminal ovals, process rectangles, input/output parallelograms, and two-way decision diamonds).

For teachers and parents

Danfo Code includes a dedicated Teacher / Classroom Mode accessible from the top bar (🎓). When turned on, all 66 levels are unlocked immediately so teachers can jump straight to loops, conditions, or functions during a lesson. The city grid enlarges for classroom projectors, and score stars are hidden to encourage shared problem-solving without competitive distraction.

Classroom activity idea: Project one device onto the board or screen. Have students physically role-play the "bus" and the "conductor", calling out the code blocks together while one student taps the screen to test the program.

Frequently asked questions

Do learners need to know how to type?
No. All code blocks are tapped into place from the palette. Older learners can switch to the Pseudocode tab to view their program as text, but no typing or drag-and-drop dexterity is required.
Does the game work offline?
Yes. Once loaded in your browser, Danfo Code runs completely offline through our service worker. Sound effects are generated in code via Web Audio—no large sound downloads or steady internet needed.
Are personal data or student programs stored on a server?
No. Progress, settings, and programs are stored exclusively on the player's device in localStorage. No accounts, emails, or personal data are ever requested.
Can older students and adults use it?
Yes. Route Masters (SSS 1–3 and adults) is written with respectful, age-neutral language ("Program the bus" rather than talking down to learners), covering parameters, state variables, and WAEC exam-style flowchart logic.