by AnswerPoint
Pro
📁 My Programs
📚 Samples
🌍 Share
🏫 Join District
🗑 Clear Canvas
🎵 Songs & Notes
💡 Explain My Code
✓ Validate
🤖
Roy
Your coding tutor
Hi! I'm Roy 👋 I can see your code. Ask me anything — "What does this do?", "I'm stuck", "What should I try next?"
100%
🔒 This program uses features above your current tier — it's loaded in read-only mode. Upgrade to run it → ×
Sprites
🐱
Sprite 1
🎨 Scape
Control
🟢 Start
🔴 End
💬 // Comment
▸ Events
🏁 When 🏁 Clicked
⌨️ When Key Pressed
🖱️ When Sprite Clicked
📡 When I Receive
📢 Broadcast
Loops
🔁 Repeat
Forever
Wait
🔄 While
🔢 For…from…to
Break
Continue
Decisions
🔀 If / Else
Variables
📦 Set
Change
🔒 Const
Motion
🚶 Move
Turn
📍 Go To
Drawing
Pen Down
Pen Up
🎨 Set Color
Pen Size
🧹 Clear Stage
Looks
🗨 Say Bubble
👁 Show
🙈 Hide
Input / Output
Ask
💬 Say
Functions
🔧 Define
📞 Call
↩️ Return
🛡 Try / Catch
Lists
📋 List Add
📥 List Get
List Set
🗑 List Clear
Fast Fill
Sound
🎵 Play Note
🎶 Play Song
🟢Start
🔁 Repeat times $count available
🎵Play for secs
Wait secs
🔴End
Stage
x: 0
y: 0
dir: 90°
✏ pen up
Code READ-ONLY $name · $count in loops
Output ×
▶ Program started
🔁 Repeat 3 times: (L1 scope)
🎵 Play 800 for 2s (L1)
⏳ Wait 1s (L1)
🎵 Play 800 for 2s (L1)
⏳ Wait 1s (L1)
🎵 Play 800 for 2s (L1)
⏳ Wait 1s (L1)
⏹ Program ended
(finished)
🗑 Drop here to delete

🏫 Join with District Code

Enter the code your teacher provided to access Playground with your school's license.

📚 Sample Programs
💾 My Programs ×
Open a saved .pg file
🔒
Upgrade Required
Starter Feature
💬 Group Chat
Policy-protected • Your group only

Choose a display name for the chat. Keep it fun and avoid your real name!

Enter your group code — everyone in your group uses the same code. Ask your parent or teacher!

No messages yet.
Be the first to say hello! 👋

💡 What Does My Code Do?

🤔 Reading your code...
Time's Up for Today!
Great coding session! You've reached your daily limit.

Come back tomorrow to keep building — your programs are saved and waiting for you! 🚀
🎵 Song Book & Note Guide
📌 Note Cheat Sheet — click any note to copy its name
C3130 Hz
D3147 Hz
E3165 Hz
F3175 Hz
G3196 Hz
A3220 Hz
B3247 Hz
C4262 Hz
D4294 Hz
E4330 Hz
F4349 Hz
G4392 Hz
A4440 Hz
B4494 Hz
C5523 Hz
D5587 Hz
E5659 Hz
F5699 Hz
G5784 Hz
A5880 Hz
B5988 Hz
Notes go from low (C3) → high (C5, B5). The 4th octave (C4–B4) is middle — great for most songs. Green chips are the main scale notes (C D E F G A B). You can also type a frequency like 440.
🎼 Starter Songs — use Fast Fill + Play Song blocks
🎵 Mary Had a Little Lamb Easy · 3 notes
listfill notes E4 D4 C4 D4 E4 E4 E4 D4 D4 D4 E4 G4 G4 playsong notes 0.4
🎵 Twinkle Twinkle Easy · 7 notes
listfill notes C4 C4 G4 G4 A4 A4 G4 F4 F4 E4 E4 D4 D4 C4 playsong notes 0.45
🎵 Hot Cross Buns Easy · 3 notes
listfill notes E4 D4 C4 E4 D4 C4 C4 C4 C4 C4 D4 D4 D4 D4 E4 D4 C4 playsong notes 0.35
🎵 Ode to Joy Medium · Beethoven
listfill notes E4 E4 F4 G4 G4 F4 E4 D4 C4 C4 D4 E4 E4 D4 D4 playsong notes 0.4
🎵 Jingle Bells Medium · Chorus
listfill notes E4 E4 E4 E4 E4 E4 E4 G4 C4 D4 E4 F4 F4 F4 F4 F4 E4 E4 E4 D4 D4 E4 D4 G4 playsong notes 0.3
🎵 Happy Birthday Medium · 5 notes
listfill notes C4 C4 D4 C4 F4 E4 C4 C4 D4 C4 G4 F4 C4 C4 C5 A4 F4 E4 D4 B4 B4 A4 F4 G4 F4 playsong notes 0.35
🎵 Row Row Row Your Boat Medium · Round
listfill notes C4 C4 C4 D4 E4 E4 D4 E4 F4 G4 C5 C5 C5 G4 G4 G4 E4 E4 E4 C4 C4 C4 G4 F4 E4 D4 C4 playsong notes 0.3
🎵 London Bridge Medium · 5 notes
listfill notes G4 A4 G4 F4 E4 F4 G4 D4 E4 F4 E4 F4 G4 G4 A4 G4 F4 E4 F4 G4 D4 G4 E4 C4 playsong notes 0.35
// ── Roy AI Panel ──────────────────────────────────────────────────────── function toggleRoy() { const panel = document.getElementById('roy-panel'); const btn = document.getElementById('btn-roy'); const open = panel.classList.toggle('open'); btn.style.color = open ? '#a78bfa' : '#a78bfa'; btn.style.background = open ? 'rgba(167,139,250,.1)' : 'transparent'; if (open) setTimeout(() => document.getElementById('roy-input').focus(), 280); } function getRoyContext() { // Grab current code from the code panel try { const codeEl = document.querySelector('.code-editor') || document.getElementById('code-editor'); if (codeEl) return codeEl.innerText || codeEl.value || ''; } catch(e) {} // Fallback: try to get Python output try { if (typeof generateCode === 'function') return generateCode() || ''; } catch(e) {} return ''; } function royAddMsg(text, role) { const msgs = document.getElementById('roy-messages'); const div = document.createElement('div'); div.className = 'roy-bubble ' + role; div.textContent = text; msgs.appendChild(div); msgs.scrollTop = msgs.scrollHeight; return div; } async function sendToRoy() { const input = document.getElementById('roy-input'); const sendBtn = document.getElementById('roy-send-btn'); const msg = input.value.trim(); if (!msg) return; input.value = ''; input.style.height = 'auto'; sendBtn.disabled = true; royAddMsg(msg, 'user'); const thinking = royAddMsg('Thinking…', 'roy thinking'); const code = getRoyContext(); const systemPrompt = `You are Roy, a friendly coding tutor for kids aged 8-14 using Playground, a visual block-based coding app. ` + `Keep responses to 2-3 sentences max. Use simple language. ` + `Never write the full code for them — guide them to figure it out. ` + `If they share code, refer to it specifically.`; const userMsg = code ? `Here is my current code: \`\`\` ${code.slice(0, 800)} \`\`\` ${msg}` : msg; try { const r = await fetch('https://apintelligence.ai/api/chat', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ system: systemPrompt, messages: [{ role: 'user', content: userMsg }] }) }); const d = await r.json(); const reply = d.response || d.content || d.message || 'Sorry, I had trouble responding. Try again!'; thinking.textContent = reply; thinking.classList.remove('thinking'); } catch(e) { thinking.textContent = 'I couldn\'t connect right now. Check your internet and try again!'; thinking.classList.remove('thinking'); } sendBtn.disabled = false; document.getElementById('roy-messages').scrollTop = 999999; } // ── End Roy ────────────────────────────────────────────────────────────── // ── Mission completion ────────────────────────────────────────────────── async function completeMission() { const lesson = window._missionLesson; const lkey = window._missionKey; if (!lesson) return; const btn = document.getElementById('mb-complete-btn'); if (btn) { btn.disabled = true; btn.textContent = '⏳ Saving…'; } try { const r = await fetch('/api/playground/lessons/' + lesson.id + '/complete', { method: 'POST', headers: { 'x-license-key': lkey||'', 'Content-Type': 'application/json' } }); const d = await r.json(); if (btn) { btn.textContent = '✓ +' + (d.xp_earned||lesson.xp_reward) + ' XP!'; btn.style.background='#27ae60'; } setStatus('Mission complete! +' + (d.xp_earned||lesson.xp_reward) + ' XP 🎉', 'ok'); setTimeout(() => { window.location.href = '/missions.html'; }, 1800); } catch(e) { if (btn) { btn.disabled=false; btn.textContent='✓ Mark Complete'; } } } // ── End mission completion ───────────────────────────────────────────────