A browser-based Logo turtle programming game. Write Logo commands to navigate a turtle through a gate while avoiding obstacles.
The app now includes an AI Challenge Lab: a local smart generator that creates verified Logo puzzles for geometry, loops, variables, and procedures, plus hint and coach controls. It is designed so a future backend LLM endpoint can replace or augment the local generator without exposing API keys in the browser.
No installation or server required. Just open index.html in your browser:
open index.htmlOr drag index.html into any browser window. That's it.
- The turtle starts at a random position on the canvas
- Type Logo commands in the text area and click Run Commands. On Mac,
Cmd+Enterruns the editor; elsewhere useCtrl+Enter. - Guide the turtle through the green GATE circle without hitting obstacles
- Each level gets harder — the gate shrinks and more obstacles appear
- Use Generate in the AI Challenge Lab to create focused practice levels by concept and difficulty
- Use Hint, Coach, or Solution when you want a nudge
| Command | Shorthand | Description |
|---|---|---|
forward 100 |
fd 100 |
Move forward |
back 50 |
bk 50 |
Move backward |
left 90 |
lt 90 |
Turn left by degrees |
right 45 |
rt 45 |
Turn right by degrees |
home |
Return to start | |
setpos 100 200 |
Jump to coordinates | |
setx 150 |
Set X position | |
sety 100 |
Set Y position | |
setheading 90 |
seth 90 |
Set absolute heading (0 = North) |
| Command | Shorthand | Description |
|---|---|---|
penup |
pu |
Lift pen (move without drawing) |
pendown |
pd |
Lower pen |
pensize 3 |
Set line thickness | |
pencolor "red" |
setpc "red" |
Set color (name or hex) |
repeat 4 [forward 100 right 90]
if :x > 50 [forward 100]
make "x 100
forward :x
to square :size
repeat 4 [forward :size right 90]
end
square 80
| Command | Returns |
|---|---|
xcor |
Current X position |
ycor |
Current Y position |
heading |
Current heading in degrees |
distance x y |
Distance to a point |
towards x y |
Heading toward a point |
The generator creates challenge layouts with a known valid route and avoids placing obstacles across that route. Each generated challenge includes:
- A programming concept: geometry, loops, variables, or procedures
- A difficulty level that changes obstacle count and gate size
- A verified sample solution
- A short hint ladder and coach feedback based on turtle position
The current implementation runs entirely in the browser. For a production AI-backed version, add a backend endpoint that returns challenge JSON, validate it with the same geometry checks, and only then apply it to the canvas.
logo-v2/
├── index.html # Main game page
├── turtle.js # Turtle canvas engine
├── logo.js # Logo language interpreter
├── game.js # Game logic (levels, gates, obstacles)
└── style.css # Styles