For a teacher with a class? The classroom edition has the full plan, slides and standards.

Homeschooling PDF

Family edition

Football Play Lab: Test Cases, One Play Against Three Defenses

Ages 14-18 ยท about 45 minutes, in one sitting

In Football Play Lab your child tests one flag football play, written in Python, against three defenses, and learns how to find the case that breaks it.

What you need

Before you start: try it once yourself

Open mytekdev.com/try/footballplaylab?lesson=test-cases-one-play-against-three-defenses&ref=fam-footballplaylab-4. A short guide opens over Level 12, Test cases, in the Python tab on X's program. The field fills the middle, seen from high behind the offense: the child's five players in team colors with flag belts, the five defenders in gray. Each player has a chip, C, Q, X, Y and Z, and each chip opens that player's own program in the Blocks and Python tabs. The box on the field says the level's goal and, after each play, what happened and why, with the seconds and the yards. The panel at the bottom right says the time since the snap, where the ball is, and how open the target receiver is.

  1. The starter. X: me.out(10). Z: me.slant(3). Q: me.drop(3), me.wait(0.6), me.throw_to("X"). C and Y run 20 yards straight. Round 1 is man, round 2 Cover 1, round 3 two deep; each wants 5 yards or more.
  2. The two fixes. X's me.out(8): 10.8, 10.8, and a touchdown against two deep. Or Q reads before the throw: if me.deep() >= 2: me.throw_to("Z") else: me.throw_to("X"); 12.4, 12.4, and Z's touchdown. Card twelve in the box is a version of the read with yards after the catch.
  3. The Practice field. Levels, Practice field. Its box has a picker for the coverage (man, Cover 1, two deep) and the rushers (0, 1, 2). The programs stay as they are.
  4. Speed. Each play runs in real time. Slower and Speed up, under the field, change the speed; the play button starts the level again from the beginning, with the programs as they are now. The play is the same on every run and every computer, so every child who makes the same change sees the same numbers.
  5. Numbers to expect. The starter: 12.4, 12.4, knocked away at 3.1 s. With the read, on the Practice field, all nine cases pass at a wait of 0.6. The wait changed: 1.2 still gains about 12.7 against man and Cover 1 and is incomplete against two deep; 1.6 is incomplete against man and Cover 1 and intercepted against two deep; 2.0 is a sack, 8 yards lost, whenever a rusher comes, incomplete against man and Cover 1 with no rusher, and intercepted against two deep with none.
Rushers never matter while the ball is out by about 1.7 seconds: they reach the quarterback in under 3. A child who reports that rushers change nothing has found something true, and the wait rows show when they start to.

The ideas, in plain words

A play, like a program, is built against the cases its designer imagined. Coaches test a play against each defense it will see, and a play that beats only one is a guess. Two deep puts a safety over each sideline, so a deep out to the sideline runs toward a defender who is already there. Nobody is ever hit: a defender who reaches the ball carrier pulls a flag from its belt, and the play is over there. The field and rules are modeled on the IFAF flag football rules for 5 on 5; the app is not affiliated with or endorsed by IFAF or any league.

The two fixes trade differently. out(8) is one change and simple, but gains less against man and Cover 1. The read keeps the longer gain where it works and changes receivers where it does not, at the cost of more code and one more thing that can go wrong. Choosing between them, and saying why, is the design decision the lesson asks for.

Teams at every level study plays with video and data, and the people who do it include coaches, video coordinators, data analysts and the software engineers who build their tools. In software, the same habit is called testing: unit tests, test matrices and regression tests.

Do it together

  1. Open mytekdev.com/try/footballplaylab?lesson=test-cases-one-play-against-three-defenses&ref=fam-footballplaylab-4 together. Press play and watch all three rounds.

    You'll know it worked when: Man and Cover 1 gain 12.4 yards each; two deep knocks the ball away at 3.1 seconds.

  2. Open Python, change me.out(10) to me.out(8), go back to Simulator and press play.

    You'll know it worked when: All three pass: 10.8, 10.8, then a touchdown.

  3. Put me.out(10) back. Click the Q chip and change the last line to: if me.deep() >= 2: me.throw_to("Z") else: me.throw_to("X"), on four lines with the throws indented.

    If you get stuck: Each throw_to goes on its own line, four spaces in, under the if and under the else.

    You'll know it worked when: All three pass: X for 12.4 twice, then Z's slant scores against two deep.

  4. Open Levels, pick Practice field, and run the play against each coverage with 0, 1 and 2 rushers.

    You'll know it worked when: All nine cases pass.

  5. Change the wait of 0.6 to 2 and run the cases with rushers again.

    You'll know it worked when: Every case with a rusher is a sack, 8 yards lost: holding the ball breaks the play.

Talk about it

Ask these while you work together. A child who has understood it can answer them without help:

The last question is the one that matters. A child who names a case, such as a slower quarterback with a rusher, and shows the result has learned to test. A child who says "it passed all three" has run the tests but not looked for the one that breaks it.

For younger and older kids

Younger: For a younger child, stop after the change to out(8), and talk about why one defense was enough to fail.

Older: For an older child, write a fix that still passes all nine cases with a wait of 1.2.

Keep going

Bring it into other subjects

For your records

Ready to copy into an hour log, a portfolio or a transcript.

LessonFootball Play Lab: Test Cases, One Play Against Three Defenses
SubjectsComputer science
Time45 minutes
What we didTested a simulated flag football play written in Python against three defenses, fixed the failing case two ways, compared the fixes, and ran a nine-case test matrix to find what still broke it.
Skills practicedTesting; Python; Design tradeoffs

Football Play Lab: Test Cases, One Play Against Three Defenses

Activity sheet (optional)

Name: ______________________________ Date: ______________

Open the app: scan the QR code, or go to mytekdev.com/try/footballplaylab?lesson=test-cases-one-play-against-three-defenses

Essential question: How do you know a program works, and not only on the case you tried?

Warm-up: A calculator gets 2 + 2 right. What would you try before you trusted it? ________________________

  1. Vocabulary. Test case, test matrix, edge case, two deep, tradeoff, regression: write each in your own words.
  2. The starter. Man: ______. Cover 1: ______. Two deep: ______.
  3. Two fixes. out(8): man ______ Cover 1 ______ two deep ______. The read: man ______ Cover 1 ______ two deep ______.
  4. My test matrix. Pass or fail. Man with 0, 1, 2 rushers: ____ ____ ____. Cover 1: ____ ____ ____. Two deep: ____ ____ ____.
  5. Slower quarterback. Wait 1.2: ________. Wait 1.6: ________. Wait 2.0: ________.

1. Which fix would you keep, and what does it cost?

2. Name a case the level did not test that broke your play, and say what happened.

Quick check

Name: ______________________________

1. A play passes against man and Cover 1 and fails against two deep. It is: (A) ready (B) ready for two of three cases (C) broken in every case

2. Three coverages with 0, 1 or 2 rushers make: (A) 3 cases (B) 6 cases (C) 9 cases

3. A friend says their program works because it ran once without an error. Use what you learned today to answer.

Answers

QuestionAnswerWhy
1BTests show it works on the cases tried; one case still fails.
2C3 x 3 = 9.
3Open answerOne run is one case. Choose cases that could break it, edge cases included, run them all, and fix what fails without breaking what passed.

If your state or umbrella school asks, this lesson covers CSTA 2017 3B-AP-21, CSTA 2017 3A-AP-15, CSTA 2017 2-AP-17.