Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo Turtle Gate Challenge

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.


How to run

No installation or server required. Just open index.html in your browser:

open index.html

Or drag index.html into any browser window. That's it.


How to play

  • The turtle starts at a random position on the canvas
  • Type Logo commands in the text area and click Run Commands. On Mac, Cmd+Enter runs the editor; elsewhere use Ctrl+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

Commands

Movement

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)

Pen

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)

Control flow

repeat 4 [forward 100 right 90]

if :x > 50 [forward 100]

Variables

make "x 100
forward :x

Procedures

to square :size
  repeat 4 [forward :size right 90]
end

square 80

Queries

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

AI Challenge Lab

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.


Project structure

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

About

Logo turtle gate challenge game + AI-powered comms generator

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages