Haunted Code Chronicles - Mission 6: The Attic

Mission 6 Lesson Plan

The Attic

Students will use encryption and conversion techniques to solve puzzles.

⏰ 45-120 minutes 🎯 Grades 5-12+ πŸ’» CodeSpace πŸ€– CodeBot 🐍 Python
View Lesson Outline
πŸ“‹

Overview

Mission 6 is the finale, and it is all about codes. Students sweep the LEDs like KITT from Knight Rider, then use the slope-intercept equation to encrypt a message and display it on the line sensor LEDs. They collect trinkets around the attic, convert letters to Morse code on the speaker, and finish by converting letters to ASCII values, shifting them, and showing the result in binary on the user LEDs.

Every challenge in this mission can be solved by brute force, so beginners can finish it with repeated code, while more experienced students can reach for loops, lists, dictionaries, and functions to score higher.

🎯 Mission Goal: Students will use encryption and conversion techniques to solve puzzles.

🎯

Learning Targets

  • I can use a loop to sweep LEDs.
  • I can use the slope-intercept equation to encrypt a message and display the results using LEDs.
  • I can convert letters to Morse Code using CodeBot's speaker.
  • I can convert letters to ASCII Code and display the numbers on LEDs.
πŸ’‘

Key Concepts

  • Two of the challenges use codes to convert data: Morse Code and ASCII Codes. This is called character encoding. Documents with the codes are on the floor of the attic.
  • Computers represent data numerically using codes. ASCII, the American Standard Code for Information Interchange, is one of the oldest codes still in use today. Each symbol on the keyboard can be converted to a number.
  • Symmetric encryption uses a single shared key to both encrypt and decrypt data.
βœ…

Assessment Opportunities

  • Complete the Mission 6 Activity Guide.
  • Complete and turn in program Hasselhoff after Objective 1.
  • Complete and turn in program TuringCar after Objective 2.
  • Complete and turn in program AtticTrinkets after Objective 3.
  • Complete and turn in program OpenTrunk after Objective 4.
  • Complete and turn in program ASCIISpell after Objective 5.
  • Record the score for the mission, found in the class dashboard.
  • Write a paragraph about their coding experience and what they learned.
β˜‘οΈ

Success Criteria

  • Sweep the user LEDs back and forth
  • Use the equation for a line to encrypt a 4-digit message
  • Display an integer using line sensor LEDs
  • Convert letters to speaker beeps using Morse code
  • Convert letters to ASCII values and then apply an algorithm to shift them
  • Display numbers using binary on user LEDs
🧰

Classroom Materials

  • β–ΈLaptop/computer with Chrome browser
πŸ”€

Vocabulary

β–Ύ
Encryption - The process of converting information or data into a code to prevent unauthorized access.
Symmetric Encryption - An encryption technique that uses a single shared key to encrypt and decrypt data.
Morse Code - A way to code letters with dots and dashes.
Character Encoding - A mapping of characters, such as letters and symbols, into numbers.
ASCII - American Standard Code for Information Interchange; a form of character encoding.

Optional Computing Terms

List - A type of variable that can hold more than one value, with items in a specific order that are accessed by using an index.
Index - The position of an item in a list; used to access the item. The first index is 0.
🐍

New Python Code

β–Ύ
leds.ls(y)
leds.ls(10)
Uses an integer (y) to turn on line sensor LEDs. Turns on line sensors 3 and 1 because 10 = 0b01010.
ord() / ord('A')A function that converts a string to its ordinal (ASCII) value
shift = shift + 2Increase a variable by 2

Optional Python Code

names = ["George", "Grace", "Alan"]
numbers = [2, 0, 2, 4]
Define a list of strings. Define a list of numbers.
name = names[1]Β Β Β # "Grace"
num = numbers[0]Β Β # 2
Access an item using an index.
morse = {
    "a": ".-",
    "b": "-...",
    "t": "-",
}
Define a dictionary with keys.
for letter in word:
for symbol in code:
Iterate through a dictionary or list.
πŸ“

Standards

β–Ύ

CSTA Standards - Grades 3-5

1B-CS-02 1B-CS-03 1B-DA-06 1B-DA-07 1B-AP-09 1B-AP-10 1B-AP-11 1B-AP-12 1B-AP-15

CSTA Standards - Grades 6-8

2-CS-02 2-CS-03 2-DA-07 2-DA-08 2-AP-10 2-AP-11 2-AP-12 2-AP-13 2-AP-14

CSTA Standards - Grades 9-10

3A-CS-03 3A-DA-09 3A-DA-12 3A-AP-13 3A-AP-14 3A-AP-16 3A-AP-17 3A-AP-18

CSTA Standards - Grades 11-12

3B-CS-02 3B-DA-06 3B-AP-10 3B-AP-14 3B-AP-16
πŸ“
Preparing for the Lesson
  • Go through the Mission in advance, if you can.
  • The first challenge is to program CodeBot's LEDs to resemble the car from Knight Rider. You can introduce the car from the 1980s NBC show with this YouTube video.
  • The mission uses binary numbers. You can introduce or review binary numbers with your students by using the binary bracelets activity. Access it through the unplugged activity, or from this website, or this one from NASA.

πŸ§‘β€πŸ«
Teacher Notes
  • Each of the challenges can be solved using brute force, meaning you don't need any for loops or lists or functions. So even beginners can complete the goals by repeating a lot of code. More experienced programmers should use programming concepts like loops, lists, functions, and parameters. Hints provide ideas and some code.
πŸ—ΊοΈ

Lesson Outline

πŸ§‘β€πŸ€β€πŸ§‘Warm-up

The warm-up questions help students think about how computers store data, and the need for data security. It is a good time for discussion. You can even circle back to these questions during or after the mission pack.

πŸ’»Mission 6 Objectives
Objective #1: This objective references the 1980s show Knight Rider and the car KITT. If you want to give students some context, you can show the trailer.
Objective #2: The challenge uses the algebraic equation for a line to encrypt a 4-letter message. Each digit in the numeric code 2024 is used as the four values for x. The m values are the 4 digits in Turing's birth year. The b values are the 4 digits in Turing's death year. Each code is displayed on the line sensor LEDs for 2 seconds. CodeTrek shows how to do the first digit. This "brute force" code works fine. Students can continue the code for the other three digits. For a higher score, students can either define a function with a parameter and call it four times, or use a list and loop.
Objective #3: The challenge for this objective is similar to other challenges: move CodeBot around the floor and collect trinkets. There is no time limit, so you may need to monitor student progress and not give them too much time. This objective is a good opportunity for a function to drive CodeBot. That is all the code needed to meet the goal. CodeBot needs to end up near the window but not crash into the wall.
Objective #4: Students first find the pocket signal disk, which is by the two lit candles. The disk has Morse code for each letter. The note indicates the keyword is "debug". Students use the pocket signal disk to find the Morse code for each letter. CodeTrek shows the values for the constants: MORSE_TONE, T_DOT, T_DASH, T_GAP and T_PAUSE. CodeTrek shows what the code looks like for a single letter. However, the letter is 'A', which is not in the word "debug", so they need to adjust the code accordingly. They can continue with this pattern for all five letters, or they can try the code given by CodeTrek. It uses a dictionary. If students want to use the dictionary, they need to add the letters e, d, u and g to it. They can be added in any order. They can get an even higher score by adding another function that plays a tone (either dash or dot).
Objective #5: The instructions guide students through using the ord() function to convert a letter to a number and then display the number using the user LEDs. Students should do the practice code before trying the challenge. This challenge can be a little tricky, because if students don't read the second hint, they will not complete the goals. The algorithm requires a shift in ASCII number. If they do the code without the shift, it should be a fairly easy fix to add it in. They subtract the shift to display the number, but increase the shift with each letter. Using a loop (and a list) works really well and gives bonus points.
πŸ§‘β€πŸ€β€πŸ§‘Reflection

The reflection questions can be written, shared as a class discussion, or handled through a think-pair-share activity. This is an opportunity to think about programming in general, what they like and don't like about it, and the skills they develop from coding.

πŸŽ‰Post Mission Pack

Other computer science topics can be discussed and studied during or after this mission, particularly data security, which can meet even more CSTA standards.

A fun follow-up activity is for students to create binary bracelets using ASCII. There are many resources available that give instructions, including the unplugged activity, this website, and this one from NASA. An alternative is to create binary posters. Girls Who Code has an activity for bracelets or posters.