• Meeting AP CSP College Board Requirements
    • Input (Big Idea 3)
    • Persistent Data Storage (Big Idea 3)
    • Sequencing (Big Idea 3)
    • Selection (Big Idea 3)
    • Iteration (Big Idea 3)
    • Lists / Collections (Big Idea 3)
    • Procedures / Functions (Big Idea 3)
    • Algorithms (Big Idea 3)
    • The Internet (Big Idea 4)
    • Impact of Computing (Big Idea 5)
  • Individual AP CSP Requirements by Team Member
    • Akhil — AP CSP Alignment
    • Moiz — AP CSP Alignment
    • Samarth — AP CSP Alignment
    • Arnav — AP CSP Alignment
    • Ethan — AP CSP Alignment
    • Aneesh — AP CSP Alignment
  • Create Performance Task Alignment
  • How the Game Works

    Our Snakes and Ladders game is a gamified educational platform that teaches AP Computer Science Principles through an interactive board game. Players learn CS concepts by progressing through the board — and the knowledge they gain directly translates into firepower for the final battles.

    Game Flow

    Login / Guest Mode
    Character Select
    Lessons (1-5)
    Questions (7-56)
    Mode Selection
    Boss Battle / PvP / SlitherRush
    Victory Page
    Hall of Champions

    Seven Sections of the Board

    Section 1 — Lessons (Squares 1–6)

    Five interactive lessons covering programming basics, data structures, networking, cybersecurity, and data ethics. Each completed lesson awards bullets that carry over to the boss fight. Completion of all five lessons unlocks the 'half2' board section via the unlocked_sections array.

    Section 2 — Question Gauntlet (Squares 7–56)

    Players roll a dice to advance across 50 squares, each containing a multiple-choice question from one of five CS topics. Correct answers earn additional bullets. Wrong answers? No penalty, but no ammo either. Reaching square 56 unlocks the 'boss' section. The server validates square ranges (QUESTION_SECTION_MIN_SQUARE = 7, QUESTION_SECTION_MAX_SQUARE = 56) before processing answers.

    Section 3 — Mode Selection Hub

    After completing enough questions, players reach the Mode Selection page (mode-selection.html) where they choose between cooperative Boss Battle, competitive PvP Arena, or the SlitherRush minigame. Real-time Socket.IO status events (pvp_status, slitherrush_status) show live player counts, active rooms, and open slots for each mode.

    Section 4 — Boss Battle (Co-op Multiplayer)

    Up to 10 players cooperate in real-time via WebSockets to defeat a dragon boss. The boss has complex AI with multiple movement patterns (dash, zigzag, chase, circle). Four powerup types (damage, speed, rapidfire, heal) spawn every 5 seconds via server-controlled rate limiting. A pre-battle lobby chat system lets players coordinate before entering (boss_join_lobby/boss_leave_lobby). In-battle group chat, tab-away detection (boss_player_away/boss_player_returned), server-authoritative spawn allocation, player-to-boss and player-to-player collision resolution, and per-player battle stats tracking (damage dealt, bullets fired, bullets hit, powerups collected) all run server-side. On boss defeat, a victory stats screen aggregates every player's contributions.

    Section 5 — PvP Arena (1v1 Competitive)

    Two players battle head-to-head in a real-time duel with server-authoritative collision resolution. Auto-matchmaking assigns players to open rooms via get_or_create_open_room(), and a dual-ready system ensures both players confirm before battle starts (pvp_readypvp_battle_start). Players are separated by a center wall barrier, using earned bullets as ammo. Movement via WASD/arrows, mouse aiming, and click/spacebar to shoot. The server resolves player-to-player overlap using resolve_player_collision() with a minimum distance of PVP_PLAYER_RADIUS * 2 (56 px). Lives tracked with health bars, in-arena chat (pvp_chat_send), tab-away detection (pvp_player_away/pvp_player_returned), authoritative position corrections (pvp_self_position), and aggregate status broadcasting keep all clients in sync.

    Section 6 — SlitherRush (Multiplayer Snake Arena)

    A slither.io-inspired minigame supporting up to 32 players per arena. Each snake is a chain of segments that grows on kills and shrinks on deaths. Players steer with directional input and hold fire to shoot bullets from the snake's head. The entire simulation is server-authoritative: a background tick loop runs at 30 Hz (SlitherRushManager.TICK_RATE = 30), state snapshots emit at 15 fps, and leaderboard updates broadcast every 450 ms. Key parameters include PLAYER_SPEED = 225, BULLET_SPEED = 640, FIRE_COOLDOWN = 0.22s, MAX_HP = 3, and SPAWN_PROTECT_SECONDS = 0.6. Arena management auto-creates rooms when all existing ones are full, and a party system (party_to_arena mapping) groups friends into the same arena. The real-time leaderboard ranks players by score, kills, and snake length.

    Section 7 — Victory Page & Hall of Champions

    Winners are directed to victory.html with animated confetti, player stats summary (bullets earned, time played, win mode), and the Hall of Champions leaderboard showing all game completers (queried via ChampionsAPI ordered by completed_at). Players can cement their victory or reset all progress via ResetProgressAPI — which preserves champion status while resetting position, bullets, lives, lessons, and character selection back to defaults.

    Characters & Powerups

    Players choose from four pixel-art characters, each with a unique visual identity:

    Character Icon Color
    Knight Shield Blue
    Wizard Magic Purple
    Archer Bow Green
    Warrior Sword Orange

    During the boss battle, four powerup types spawn on the arena (rate-limited to one spawn every POWERUP_SPAWN_INTERVAL = 5 seconds per room):

    • Damage Boost — 2x damage for 8 seconds
    • Speed Boost — 1.5x movement speed for 10 seconds
    • Rapid Fire — +15 bullets instantly
    • Health Restore — Recover 1 life (or +10 bullets if full)

    Powerup collection is tracked server-side per player (powerups_collected[]) and broadcast to all room members via the boss_powerup_collected event.

    Lives & Game State System

    Every player starts with 5 lives and a game_status of 'active'. The SnakesGameData model tracks lives, boss_battle_attempts, and completed_at timestamp. When a player reaches square 100 or defeats the boss, the CompleteGameAPI sets game_status = 'completed' and records the completion time. The ResetPositionAPI resets position, lives, and status for boss-battle retries.

    Active Players Tracking

    The ActivePlayersAPI endpoint queries all SnakesGameData records updated within the last 10 seconds (timedelta(seconds=10)) to show who is currently playing in real-time. This powers the live player count displays on the game board and mode selection pages.


    Technical Architecture & Transactional Data

    The system uses a Jekyll static frontend communicating with a Flask (Python) backend via REST APIs and WebSocket connections.

    File Structure

    LayerFilePurpose
    Frontendgame-board-part1.htmlLessons, character selection, login
    game-board-part2.htmlQuestion board with dice rolling
    mode-selection.htmlBattle mode hub (Boss vs PvP vs SlitherRush)
    boss-battle.htmlCo-op boss arena with canvas rendering
    pvp-arena.html1v1 competitive arena with center wall
    victory.htmlVictory celebration, Hall of Champions
    Shared JSsnakes-game.jsCore game logic, API calls, autosave
    questions_bank.js50 questions across 5 CS topics
    Backend APIapi/snakes_game.pyCRUD, leaderboard, champions, active players, reset
    api/snakes_extended.pyLessons, questions, section unlocking, progress
    api/boss_battle.pyBattle room creation/joining
    WebSocketsocketio_handlers/boss_battle.pyBoss battle + PvP sync, lobby chat, powerups, collision resolution
    socketio_handlers/slitherrush_manager.pySlitherRush arena state, 30Hz tick, bullet physics, snake segments
    socketio_handlers/slitherrush_events.pySlitherRush Socket.IO event handlers, JWT auth for sockets
    socketio_handlers/socket_server.pyDedicated Socket.IO server (port 8500, eventlet async)
    Modelsmodel/snakes_game.pySnakesGameData (progress, bullets, lives, sections, lessons)
    model/game_progress.pyGameProgress, SquareCompletion tracking
    model/boss_room.pyBossRoom, BossPlayer, BossBattleStats

    How Transactional Data Flows

    Every user action triggers a backend transaction. Here are the key data flows:

    Lesson Completion:

    Complete Lesson
    POST /api/snakes/complete-lesson
    Server updates completed_lessons[] & total_bullets
    Unlock next section

    Answering Questions:

    Answer Question
    POST /api/snakes/answer-question
    Update current_square, visited_squares[]
    Award bullets if correct

    Autosave (Every 10 seconds):

    Timer fires
    PUT /api/snakes/
    Save full state (square, bullets, lives, time, lessons, sections)

    Boss Battle (Real-time):

    boss_join_lobby
    Pre-battle Chat
    boss_join_room
    Server spawn allocation
    Position sync + Collision resolution + Powerup spawn (5s)

    PvP Arena (Real-time):

    pvp_join
    Auto-matchmaking
    pvp_ready (both players)
    pvp_battle_start
    Server collision + Position authority

    SlitherRush (Real-time):

    slitherrush_join
    Arena assignment (≤32 players)
    slitherrush_input (direction + shoot)
    Server tick loop (30Hz) → State snapshot (15fps)

    Game Completion:

    Reach end / Defeat boss
    POST /api/snakes/complete
    Set game_status='completed', record completed_at
    Victory page → Hall of Champions

    Key API Transactions

    Action Method & Endpoint Payload Server Response
    Load progress GET /api/snakes/ Full game state
    Get progress GET /api/snakes/progress Auto-creates record if missing
    Complete lesson POST /api/snakes/complete-lesson {lesson_number, bullets_earned} Updated totals + unlocked_sections
    Answer question POST /api/snakes/answer-question {square, bullets_earned, correct} Updated position + section unlocks
    Update game state PUT /api/snakes/update-game {current_square, lives, ...} Full game state
    Complete game POST /api/snakes/complete game_status='completed' + timestamp
    Reset progress POST /api/snakes/reset Fresh state, preserves champion history
    Get active players GET /api/snakes/active-players Players updated within last 10s
    Get champions GET /api/snakes/champions All completers ordered by time
    Get leaderboard GET /api/snakes/leaderboard ?limit=10 Top players by bullets
    Add bullets POST /api/snakes/add-bullets {bullets} Updated total_bullets
    Update square POST /api/snakes/update-square {square} Updated position + visited list
    Get unvisited GET /api/snakes/unvisited-squares Unvisited count + list

    Authentication Flow

    All API calls are secured with JWT tokens stored in HttpOnly cookies. The @token_required() decorator extracts the user ID from the token payload and associates all game data with the correct SnakesGameData database record. Guest/demo mode uses sessionStorage as a fallback with no server persistence.


    Team Work Split

    Akhil

    Scrum Master / Multiplayer & Victory System Developer
    ⚡ Real-time Multiplayer Sync — connects players across the world in milliseconds
    • Project coordination, sprint planning, and stand-ups
    • WebSocket handler (socketio_handlers/boss_battle.py) — Boss Battle, PvP Arena, lobby chat, powerup system
    • Server-authoritative collision resolution (resolve_player_collision()) for Boss and PvP
    • Server-authoritative spawn allocation (allocate_boss_spawn()) with grid fallback
    • Pre-battle lobby system (boss_join_lobby/boss_leave_lobby) with member tracking
    • Tab-away detection (boss_player_away/boss_player_returned) for Boss and PvP
    • Per-player battle stats tracking (damage_dealt, bullets_fired, bullets_hit, powerups_collected)
    • PvP auto-matchmaking (get_or_create_open_room()) and dual-ready system
    • In-arena chat for both Boss Battle and PvP modes
    • victory.html with confetti animation, Hall of Champions, and victory stats screen
    • Leaderboard API, Champions API, Active Players API, Complete Game and Reset Progress endpoints
    • Autosave mechanism (10s interval) and demo/guest mode
    • Dedicated Socket.IO server (socket_server.py, port 8500, eventlet async)
    Code Snippet ```python # Server-authoritative collision resolution (socketio_handlers/boss_battle.py) def resolve_player_collision(desired_x, desired_y, other_x, other_y, min_dist): dx = desired_x - other_x dy = desired_y - other_y dist = math.sqrt(dx * dx + dy * dy) if dist < 0.001: return other_x + min_dist, desired_y, True if dist >= min_dist: return desired_x, desired_y, False overlap = min_dist - dist nx, ny = dx / dist, dy / dist return desired_x + nx * overlap, desired_y + ny * overlap, True ```

    Moiz

    DevOps / Authentication Lead
    🔐 Secure Sessions — JWT tokens keep your game data safe across devices
    • Backend deployment: Dockerfile, docker-compose, Nginx
    • Production environment variables and CORS config
    • JWT authentication system (api/jwt_authorize.py)
    • Cookie management and @token_required() decorator
    • WebSocket JWT authentication (_resolve_socket_user() in slitherrush_events.py) — decodes JWT from cookies for socket connections
    • Snakes SFX system (procedural audio + toggle)
    • Flask application factory, server configuration, and database initialization (scripts/game_init.py)
    Code Snippet ```python # WebSocket JWT auth (socketio_handlers/slitherrush_events.py) def _resolve_socket_user(): token_name = current_app.config.get('JWT_TOKEN_NAME', 'jwt') token = request.cookies.get(token_name) if not token: return None decoded = jwt.decode(token, current_app.config['SECRET_KEY'], algorithms=['HS256']) uid = decoded.get('_uid') return User.query.filter_by(_uid=uid).first() ```

    Samarth

    Lesson System Developer
    📚 Progressive Learning — turns CS education into unlockable game achievements
    • Five interactive lesson pages (lessons/lesson1-5.html)
    • Arcade-style lesson CSS and UI animations
    • POST /api/snakes/complete-lesson endpoint with server-side validation (lesson 1–5 range check)
    • Section unlocking logic: half1half2 (after all 5 lessons) → boss (after reaching square 56)
    • Lesson completion tracking via completed_lessons[] (MutableList/JSON column) and bullet rewards
    • Progress persistence across sessions via GET /api/snakes/progress (auto-creates record if missing)
    Code Snippet ```python # Section unlocking on lesson completion (api/snakes_extended.py) if lesson_number not in record.completed_lessons: record.completed_lessons.append(lesson_number) record.total_bullets += bullets_earned # Unlock second half after completing all five lessons if len(set(record.completed_lessons)) >= 5 and 'half2' not in record.unlocked_sections: record.unlocked_sections.append('half2') ```

    Arnav

    Boss Battle & PvP Developer
    🐉 Combat Systems — brings intense boss AI and competitive PvP to educational gaming
    • Full boss-battle.html with canvas-based rendering and server-authoritative position sync
    • Pixel-art character sprites and boss AI movement patterns (normal, dash, zigzag, chase, circle)
    • Bullet physics and collision detection (Math.hypot) with server-validated bounds clamping
    • pvp-arena.html with center wall, 1v1 mechanics, and server-authoritative position corrections
    • Powerup system: 4 types (damage, speed, rapidfire, heal), server-controlled spawn rate, per-player collection tracking
    • Boss victory stats aggregation — collects all players' damage_dealt, bullets_used, lives, and powerups on boss defeat
    • SlitherRush frontend — slither.io-inspired multiplayer snake arena with directional steering and shooting
    • Database models: BossRoom, BossPlayer, BossBattleStats, GameProgress, SquareCompletion
    Code Snippet ```python # Boss defeated — aggregate all player stats (socketio_handlers/boss_battle.py) if boss_battles[room_id]['boss_health'] <= 0: all_player_stats = [] for player_sid, player_data in boss_battles[room_id]['players'].items(): all_player_stats.append({ 'username': player_data.get('username', 'Unknown'), 'damage_dealt': player_data.get('damage_dealt', 0), 'lives': player_data.get('lives', 0), 'powerups_collected': player_data.get('powerups_collected', []) }) emit('boss_defeated', {'all_player_stats': all_player_stats}, room=room_id) ```

    Ethan

    Question System Developer
    🧠 Knowledge Testing — 50 unique questions that make learning feel like a game
    • 50-question bank across 5 CS topics (questions_bank.js)
    • Question modal template and answer validation
    • POST /api/snakes/answer-question endpoint with server-side square range validation (QUESTION_SECTION_MIN_SQUARE to QUESTION_SECTION_MAX_SQUARE)
    • Bullet-awarding logic for correct answers; automatic 'boss' section unlock when reaching square 56
    • Square visit tracking via visited_squares[] (MutableList/JSON) to prevent re-answering
    • Unvisited squares API (GET /api/snakes/unvisited-squares) returning visited/unvisited counts
    • Visual feedback for correct/incorrect answers
    Code Snippet ```python # Answer question with section unlock (api/snakes_extended.py) record.current_square = square if square not in record.visited_squares: record.visited_squares.append(square) if correct: record.total_bullets += bullets_earned # Unlock boss battle when reaching square 56 if square >= QUESTION_SECTION_MAX_SQUARE and 'boss' not in record.unlocked_sections: record.unlocked_sections.append('boss') ```

    Aneesh

    Game Board Lead
    🎲 User Experience — smooth navigation and satisfying dice mechanics that make the game addictive
    • Main game board UI and dice-rolling mechanics
    • Character selection carousel with pixel-art sprites
    • Character perks (knight/wizard/archer/warrior)
    • Mode Selection hub page (mode-selection.html) — now shows Boss Battle, PvP Arena, and SlitherRush with live player counts via Socket.IO status events
    • Frontend navigation flow between all game pages
    • game-board-part1.html, game-board-part2.html
    • Board square rendering and progression visualization with split-board unlock indicators (half1/half2/boss)
    • SlitherRush manager and simulation (slitherrush_manager.py, slitherrush_simulation.py) — 30Hz server tick loop, arena auto-creation, party system, snake segment physics, bullet spawning
    • Guest mode (sessionStorage-based progress)
    Code Snippet ```python # SlitherRush 30Hz tick loop (socketio_handlers/slitherrush_events.py) def _tick_loop(): while _manager is not None: now = time.time() dt = max(0.0, min(0.1, now - last)) with _manager.lock: _simulation.step(now, dt) for arena in list(_manager.arenas.values()): if now - arena['last_snapshot_at'] >= _manager.SNAPSHOT_INTERVAL: arena['last_snapshot_at'] = now _manager.emit_state(arena, now) time.sleep(_manager.TICK_INTERVAL) # 1/30s ```

    Meeting AP CSP College Board Requirements

    Our game directly addresses multiple College Board AP CSP requirements through its design and implementation:

    Input (Big Idea 3)

    Users provide input through HTML form elements (character selection clicks, question answer buttons, chat text input) and JavaScript event listeners (keyboard WASD/arrows for movement, mouse position for aiming, spacebar/click for shooting).

    Persistent Data Storage (Big Idea 3)

    Game state is stored in a relational database (SQLite/MySQL) via Flask-SQLAlchemy. Player progress (current_square, total_bullets, completed_lessons, visited_squares) persists across sessions through authenticated API calls.

    Sequencing (Big Idea 3)

    The game enforces ordered execution: lessons must complete before questions unlock, questions must be answered before the boss section unlocks. API calls execute sequentially (fetch progress → validate → update → respond).

    Selection (Big Idea 3)

    Conditionals drive game logic throughout: if (correct) awards bullets, if (lives <= 0) triggers death, if (square >= 56) unlocks boss, if (bossHealth <= 0) ends the battle. The backend validates conditions before granting access.

    Iteration (Big Idea 3)

    Loops run the game: requestAnimationFrame drives the render loop, setInterval handles autosave (10s), position broadcasting (50ms), and powerup spawning (5s). The SlitherRush server tick loop runs at 30 Hz, iterating all arenas, players, and bullets each frame. The question system iterates through visited_squares to track progress.

    Lists / Collections (Big Idea 3)

    Arrays and JSON objects store structured data: visited_squares[], completed_lessons[], unlocked_sections[], powerups[], otherPlayers{}, slither_segments[], arena['bullets']. The backend manages MutableList/JSON columns for in-place list mutation with SQLAlchemy persistence.

    Procedures / Functions (Big Idea 3)

    Modular functions with parameters and return values: resolve_player_collision(x, y, ox, oy, dist), allocate_boss_spawn(room_id, radius, bounds), spawn_powerup_for_room(room_id), _step_bullets(arena, now, dt). Backend uses decorated route handlers with request parsing and WebSocket event handlers.

    Algorithms (Big Idea 3)

    The boss AI implements pathfinding with pattern switching (normal, dash, zigzag, chase, circle). Collision detection uses the distance formula (Math.hypot, math.sqrt). SlitherRush bullet-hit detection uses squared-distance comparison against hit_radius_sq. Safe spawn allocation tries random positions then falls back to grid scan. The leaderboard sorts players by (score, kills, length).

    The Internet (Big Idea 4)

    The game operates over HTTP/HTTPS with RESTful APIs (GET, POST, PUT) and WebSocket connections for real-time multiplayer. A dedicated Socket.IO server runs on port 8500 with eventlet async mode. JWT tokens authenticate both HTTP requests and WebSocket connections (via cookie-based _resolve_socket_user()). CORS headers control access, and Nginx handles reverse proxying.

    Impact of Computing (Big Idea 5)

    The game itself teaches CS ethics and data privacy concepts through its lesson content. Guest mode demonstrates data minimization principles — no personal data is collected for unauthenticated users.


    Individual AP CSP Requirements by Team Member

    Each team member’s contribution demonstrates specific College Board requirements:

    Akhil — AP CSP Alignment

    Multiplayer & Victory
    • The Internet: WebSocket events (emit/on) for real-time sync; dedicated Socket.IO server on port 8500 with eventlet async
    • Iteration: setInterval broadcasts position every 50ms; autosave every 10s; powerup spawn rate-limiting loop
    • List: boss_battles[room_id]['players'] dict; lobby_members{}; pvp_rooms{}; champions[]
    • Procedure: resolve_player_collision(desired_x, desired_y, other_x, other_y, min_dist) with 5 parameters and return tuple
    • Algorithm: Collision resolution calculates distance, detects overlap, normalizes push vector — uses sequencing, selection (if dist >= min_dist), and math (math.sqrt)
    • Data Storage: ChampionsAPI queries completed games; ResetProgressAPI clears state while preserving champion history; ActivePlayersAPI filters by 10-second threshold

    Moiz — AP CSP Alignment

    Authentication & DevOps
    • The Internet: JWT tokens over HTTPS, CORS configuration, cookie security flags; WebSocket JWT auth via _resolve_socket_user()
    • Selection: if not token returns 401; if token_expired returns 403; socket auth falls back through current_user → cookie → None
    • Procedure: @token_required() decorator with nested function and return; _resolve_user_identity(payload) resolves user from socket context
    • Data Storage: User credentials hashed with bcrypt, stored in SQLAlchemy; game_init.py manages DB initialization and test data creation
    • Impact: Guest mode protects privacy; no data stored without authentication

    Samarth — AP CSP Alignment

    Lesson System
    • Sequencing: Lessons 1-5 must complete; all 5 trigger half2 unlock; section progression enforces half1half2boss
    • Selection: if lesson_number not in record.completed_lessons prevents duplicate completion; if len(set(completed_lessons)) >= 5 unlocks half2
    • List: completed_lessons[] (MutableList/JSON column) and unlocked_sections[] tracked server-side
    • Procedure: complete_lesson() validates lesson range (1–5), appends to list, awards bullets, checks unlock condition
    • Data Storage: Lesson progress persists via POST /api/snakes/complete-lesson; auto-creates record via GET /api/snakes/progress

    Arnav — AP CSP Alignment

    Boss Battle & PvP
    • Algorithm: Boss AI uses distance formula Math.hypot(dx,dy) for chase pattern; server-side safe spawn uses random sampling with grid fallback (allocate_boss_spawn)
    • Iteration: requestAnimationFrame game loop at 60fps; bullet array updates; powerup spawn loop with POWERUP_SPAWN_INTERVAL rate limiting
    • Selection: if (pattern === 'zigzag') changes movement; if (collision) damages; if (bossHealth <= 0) triggers victory stats aggregation
    • List: playerBullets[], opponentBullets[], powerups[], all_player_stats[] arrays; powerups_collected[] per player
    • Procedure: spawn_powerup_for_room(room_id) creates random powerup, stores in room state, returns powerup dict

    Ethan — AP CSP Alignment

    Question System
    • List: QUESTIONS[] array of 50 objects; visited_squares[] (MutableList/JSON) for tracking; unvisited_squares computed as set difference
    • Iteration: forEach to render answer options; list comprehension [sq for sq in all_squares if sq not in visited] for unvisited calculation
    • Selection: if correct: record.total_bullets += bullets_earned; if square >= QUESTION_SECTION_MAX_SQUARE unlocks boss
    • Procedure: answer_question() validates square range, updates position, awards bullets, checks section unlock — uses parameter and return
    • Algorithm: Server validates square bounds (QUESTION_SECTION_MIN_SQUARE to QUESTION_SECTION_MAX_SQUARE) before processing

    Aneesh — AP CSP Alignment

    Game Board & Navigation & SlitherRush
    • Input: Click handlers for dice rolls, character selection buttons, navigation links; directional input + fire for SlitherRush
    • Selection: if (roll + currentSquare > 56) redirects to mode selection; if player.status != 'alive' skips movement in tick
    • Iteration: for loop renders 56 board squares; SlitherRush 30Hz tick iterates all arenas, all players, all bullets each frame
    • Procedure: _step_move_players(arena, now, dt) with 3 parameters — updates direction, moves head, trims/extends segments, fires bullets
    • Algorithm: SlitherRush bullet-hit detection: iterates bullets, computes squared distance to each player head, checks against hit_radius_sq, applies kill/death/score/length updates
    • List: Character array for carousel; arena['players'] dict; arena['bullets'] list; slither_segments[] per snake

    Create Performance Task Alignment

    The project structure maps directly to the CPT requirements:

    • Program Purpose: Educate users on AP CSP concepts through gamified learning
    • Program Function: Interactive game board with progression, questions, multiplayer boss battle, PvP arena, and SlitherRush snake arena
    • Input → Output: User answers (input) → bullet rewards and progression (output); keyboard/mouse (input) → character movement and shooting (output); directional input (input) → snake steering and bullet firing in SlitherRush (output)
    • List Usage: visited_squares[] stores/retrieves which questions have been answered; completed_lessons[] tracks lesson progress; unlocked_sections[] controls board access; arena['bullets'] manages projectiles; slither_segments[] stores snake body positions
    • Procedure with Parameter: resolve_player_collision(desired_x, desired_y, other_x, other_y, min_dist) takes 5 parameters, calculates distance with math.sqrt, uses selection to check overlap, returns adjusted coordinates — used in both Boss Battle and PvP
    • Algorithm with Sequencing + Selection + Iteration: SlitherRush _step_bullets() sequences through bullet movement (update position → check bounds → detect hits), iterates all bullets against all players, selects actions based on distance check (if dist_sq <= hit_radius_sq), and applies kill/death/score/length changes