๐Ÿšช Welcome to the CSP 3.4 Escape Room! ๐Ÿšช

๐Ÿ” The Digital Escape Challenge ๐Ÿ”

You find yourself trapped in a digital maze...

Only by mastering String Operations and Algorithms can you escape!

๐Ÿ“– The Story

You are a programmer who has been mysteriously transported into a digital world. The only way out is to solve a series of coding challenges that test your knowledge of:

  • String Manipulation ๐Ÿ”ค
  • Algorithm Design โš™๏ธ
  • Problem Solving ๐Ÿงฉ
  • Code Optimization โšก

๐ŸŽฏ Your Mission

Navigate through 5 challenging levels, each testing different aspects of CSP 3.4 concepts:

  1. Level 1: Basic String Operations
  2. Level 2: String Searching and Patterns
  3. Level 3: Algorithm Efficiency
  4. Level 4: Complex String Algorithms
  5. Level 5: Final Boss Challenge

๐Ÿ† Rewards

  • Bronze Badge: Complete 3 levels
  • Silver Badge: Complete 4 levels
  • Gold Badge: Complete all 5 levels
  • Master Coder: Complete all levels with optimal solutions

๐Ÿ“š Teach First: AP CSP 3.4 โ€” Strings (Read This Before You Start)

This short article aligns to the AP Computer Science Principles Course and Exam Description (CED), Topic 3.4: Strings. Read it first, then hit Start.

Key ideas (AP pseudocode vs Python)

  • A string is a sequence of characters (text).
  • AP pseudocode functions you must recognize:
    • LENGTH(s) โ†’ number of characters
    • CONCAT(a, b) โ†’ join two strings
    • subString(s, start, end) โ†’ inclusive, 1-based indices
  • Python equivalents (used here only to practice thinking in code):
    • len(s), a + b, s[start:end] with 0-based, end-exclusive slices

I Do: Examples (AP Pseudocode)

// Given s โ† "COMPUTER SCIENCE"
LENGTH(s)                     // 17
CONCAT("AP ", "CSP")           // "AP CSP"
subString(s, 1, 8)            // "COMPUTER"
// Traverse each character
i โ† 1
REPEAT UNTIL i > LENGTH(s)
  DISPLAY subString(s, i, i)
  i โ† i + 1
END REPEAT

I Do: Examples (Python)

s = "COMPUTER SCIENCE"
len(s)            # 17
"AP " + "CSP"    # "AP CSP"
s[0:8]            # "COMPUTER"  (0-based; end index excluded)
for ch in s:
    print(ch)

We Do: Common Patterns (Youโ€™ll use these in the levels)

  • Prefix / Suffix checks (AP):
    • subString(s, 1, LENGTH(t)) = t โ†’ starts with t
    • subString(s, LENGTH(s)-LENGTH(t)+1, LENGTH(s)) = t โ†’ ends with t
  • Contains a substring (AP):
    • Traverse indices i from 1 to LENGTH(s)-LENGTH(t)+1 and compare subString(s, i, i+LENGTH(t)-1) = t
  • Build a message:
    • CONCAT(โ€œHello, โ€œ, name)

Pitfalls to avoid

  • Donโ€™t mix index systems. AP indices start at 1 and subString end is inclusive.
  • In Python, slices start at 0 and the end is excluded.
  • Focus on the logic; answers on the AP Exam use the AP pseudocode model.

Quick Checks (self-check)

1) What does subString("ALGORITHM", 3, 6) return? It returns "GORI".
2) In AP pseudocode, how do you get the last character of s? subString(s, LENGTH(s), LENGTH(s))
3) True/False: LENGTH("AP CSP") is 5. True (space counts as a character).

Try It (very short warmup)

  • Write, in words, how you would check if s starts with โ€œAPโ€ using AP pseudocode.
  • How would you count the number of spaces in s using traversal?

References

  • AP CSP CED PDF โ†’ Topic 3.4 Strings (see provided course link)
  • AP Daily videos for Topic 3.4 in AP Classroom (watch before you play)

Once youโ€™ve read this, click Start to see the Rules and then head to the Levels hub. Good luck! ๐Ÿš€

๐Ÿง  Warm-up Question (Optional Bonus)

Before you dive in, answer this quick question for a small bonus:

What Python data type will you be working with throughout this escape room?

๐Ÿ‘€ What to Expect

๐Ÿ”ง Skills Youโ€™ll Practice:

  • String concatenation and manipulation
  • Substring operations
  • Pattern matching and searching
  • Algorithm complexity analysis
  • Code optimization techniques

๐ŸŽฎ Game Features:

  • Interactive Challenges: Hands-on coding problems
  • Real-time Feedback: Instant validation of your solutions
  • Progress Tracking: See your advancement through the levels
  • Hints System: Get help when youโ€™re stuck
  • Leaderboard: Compete with your classmates

โฑ๏ธ Time Challenges:

  • Each level has a recommended completion time
  • Bonus points for efficient solutions
  • Global timer tracks your total escape time

๐Ÿ“š Before You Begin:

Make sure you're familiar with:

  • Basic Python syntax
  • String operations in Python
  • Function definitions and calls
  • Basic algorithm concepts

Ready to test your coding skills? Click the START YOUR ESCAPE button above! ๐ŸŽฏ