Week 1 Sprint 1 CPT Requirements
Pseudocode to Python and JavaScript translation cheat sheet with runnable examples.
Week 1 Sprint 1
Code examples that demostrate how the server of a game uses player data (given) to produce outputs. Each code example are changed and fits into the themes of coding.
Time Reminder System in Game
This time reminder system is important because it helps prevent game addiction, which is one of the main factors that can lead to academic stress and threats to personal life. By tracking playtime and showing reminders when usage gets too high, the system encourages healthier habits, better time management, and a safer balance between gaming, school responsibilities, and real-world well-being.
Quick Translation Cheat Sheet
| Pseudocode | Python | JavaScript |
|---|---|---|
x ← value |
x = value |
let x = value; |
DISPLAY(text) |
print(text) |
console.log(text); |
INPUT("Prompt") |
input("Prompt") |
prompt("Prompt") |
IF / ELSE |
if / else |
if / else |
FOR EACH item IN list |
for item in list: |
for (const item of list) {} |
APPEND(list, item) |
list.append(item) |
list.push(item) |
INSERT(list, i, item) |
list.insert(i, item) |
list.splice(i, 0, item) |
REMOVE(list, i) |
list.pop(i) |
list.splice(i, 1) |
LENGTH(list) |
len(list) |
list.length |
PROCEDURE name(args) |
def name(args): |
function name(args) {} |
RETURN(value) |
return value |
return value; |
1. Input
CPT Requirement: Your program must produce output visible to the user. College Board pseudocode uses DISPLAY() to show results, including strings, numbers, or variable values. On the exam, you will trace DISPLAY statements to predict program output. For CPT, clear output demonstrates your program’s purpose and functionality.
Code Runner Challenge
Run the pseudocode version for player input and display logic.
Code Runner Challenge
Translate player input and display logic into Python.
Code Runner Challenge
Translate player input and display logic into JavaScript.
2. List
CPT Requirement: Your program must get input from the user. College Board pseudocode uses INPUT() to collect data, which makes programs interactive and personalized. On exam questions, you will identify where input affects program behavior. For CPT scoring, input shows your program responds to different user data.
Code Runner Challenge
Run the pseudocode version for player session tracking with list traversal.
Code Runner Challenge
Translate player session tracking with list traversal into Python.
Code Runner Challenge
Translate player session tracking with list traversal into JavaScript.
3. Procedure
CPT Requirement: Your program must use a list (or another collection type) to manage multiple data values. Critical exam detail: College Board pseudocode lists start at index 1, not 0. Accessing index 0 or going beyond LENGTH terminates the program. On exam questions, you will trace list operations and identify index errors. For CPT, lists help demonstrate algorithm implementation and complexity management.
Code Runner Challenge
Run the pseudocode version for a player-status procedure.
Code Runner Challenge
Translate a player-status procedure with nested selection into Python.
Code Runner Challenge
Translate a player-status procedure with nested selection into JavaScript.
4. Sequence
CPT Requirement: You must create at least one student-developed procedure with parameters. College Board pseudocode uses PROCEDURE name(parameters) with optional RETURN(value). This demonstrates abstraction by hiding complexity and enabling reuse. On the exam, you will trace procedure calls and parameter passing. For CPT, the procedure must be called at least once and contribute to functionality.
Code Runner Challenge
Run the pseudocode version for sequence and total playtime output.
Code Runner Challenge
Translate a sequence that computes total playtime and decision output into Python.
Code Runner Challenge
Translate a sequence that computes total playtime and decision output into JavaScript.
5. Selection
Exam Concept: Sequencing means statements execute in order, line by line. Every program uses sequence as the default flow. On exam questions, you will trace execution order to predict variable values. For CPT, logical step-by-step calculations show you understand systematic data processing.
Code Runner Challenge
Run the pseudocode version for conditional playtime checks.
Code Runner Challenge
Translate conditional playtime checks into Python.
Code Runner Challenge
Translate conditional playtime checks into JavaScript.
6. Iteration
CPT Requirement: Your algorithm must include selection using IF or IF/ELSE statements. College Board pseudocode uses curly braces { } to mark code blocks. Selection makes decisions based on Boolean conditions and allows different outcomes. On the exam, you will trace which branch executes for specific condition values. For CPT, selection demonstrates handling different data appropriately.
Code Runner Challenge
Run the pseudocode version for repeat-until style session entry.
Code Runner Challenge
Translate repeat-until style play session entry into Python.
Code Runner Challenge
Translate repeat-until style play session entry into JavaScript.
7. Algorithm
CPT Requirement: Your algorithm must include iteration (loops) using FOR EACH, REPEAT TIMES, or REPEAT UNTIL. Iteration processes multiple data items without duplicate code. On the exam, you will trace loop counters and predict how many times a block executes. For CPT, iteration demonstrates handling collections and algorithm complexity.
Code Runner Challenge
Run the pseudocode version for average playtime algorithm.
Code Runner Challenge
Translate a playtime-average algorithm into Python.
Code Runner Challenge
Translate a playtime-average algorithm into JavaScript.
8. List Operations
CPT Requirement: Your algorithm must integrate sequencing, selection, and iteration to solve a meaningful problem. College Board defines an algorithm as a precise step-by-step process that accomplishes a task. On the exam, you will analyze complete algorithms for correctness and efficiency. For CPT, this is the core implementation where you demonstrate complexity and earn algorithm points.
Code Runner Challenge
Run the pseudocode version for linear player search.
Code Runner Challenge
Translate linear search of player names with playtime checks into Python.
Code Runner Challenge
Translate linear search of player names with playtime checks into JavaScript.
9. Search Algorithm
Exam Topic: College Board pseudocode includes key list operations: APPEND(list, value) adds to end, INSERT(list, index, value) adds at position, REMOVE(list, index) deletes by position, and LENGTH(list) returns count. On exam questions, you will trace how these operations change lists and indices. For CPT, list manipulation demonstrates data management and algorithm complexity.
Code Runner Challenge
Run the pseudocode version for task list operations.
Code Runner Challenge
Translate player task list operations into Python.
Code Runner Challenge
Translate player task list operations into JavaScript.
10. Boolean Logic
Exam Topic: Linear search is a common AP exam algorithm pattern. It demonstrates iteration through a list, selection to check conditions, and return values. On exam questions, you will identify search logic, trace execution, and determine returned values for found and not-found cases. For CPT, implementing search demonstrates algorithmic thinking and practical data processing.
Code Runner Challenge
Run the pseudocode version for player lookup and conditional display.
Code Runner Challenge
Translate player lookup and conditional display logic into Python.
Code Runner Challenge
Translate player lookup and conditional display logic into JavaScript.
11. Find Student Grade
Exam Concept: College Board pseudocode uses AND, OR, and NOT to combine conditions. Boolean expressions evaluate to true or false. On the exam, you will trace complex conditions and predict which blocks execute. For CPT, Boolean logic supports more sophisticated decisions, such as validation and access checks, and demonstrates program complexity.
Code Runner Challenge
Run the pseudocode version for returning matched player hours.
Code Runner Challenge
Translate a procedure returning matched player hours into Python.
Code Runner Challenge
Translate a procedure returning matched player hours into JavaScript.
Software Development Life Cycle (SDLC)
The development cycle involves iterative steps of running the server, making changes, testing, committing, and syncing changes to GitHub. This process ensures that your website is updated and functioning correctly both locally and on GitHub Pages.
SDLC Workflow
+-------------------+ +-------------------+ +-------------------+ +-------------------+ +-------------------+
| | | | | | | | | |
| Make Server | ----> | Change Code | ----> | Commit | ----> | Test | ----> | Sync |
| | | | | | | | | |
+-------------------+ +-------------------+ +-------------------+ +-------------------+ +-------------------+
| | | | |
v v v v v
Start Local Server Edit Code Files Stage Changes Locally Verify Local Changes Push Changes to Cloud