honu/README.md
2025-12-12 08:39:35 -08:00

72 lines
1.4 KiB
Markdown

# 🐢 Honu
LOGO-style turtle graphics powered by Shrimp.
## Quickstart
```bash
bun install
bun dev
```
Open http://localhost:3002
This builds the app and serves the `dist/` folder with Python's built-in HTTP server.
## Building
```bash
bun run build
```
Outputs a bundled browser app to `dist/`. The `dist/` folder contains:
- `index.html` - The main page
- `app.js` - Bundled JavaScript (Parser + Compiler + ReefVM + CodeMirror)
You can serve the `dist/` folder with any static file server, or even open `index.html` directly in a browser.
## LOGO Commands
### Movement
- `forward n` - Move forward n pixels
- `back n` - Move backward n pixels
- `left n` - Turn left n degrees
- `right n` - Turn right n degrees
### Pen Control
- `pen up` - Lift pen (don't draw)
- `pen down` - Lower pen (draw)
- `setcolor n` - Set pen color (0-15)
- `setwidth n` - Set pen width
- `clearscreen` - Clear the canvas
### Turtle Control
- `home` - Return to center, heading up
- `setheading n` - Set heading to n degrees
- `setpos x y` - Set position to (x, y)
- `position` - Get current position
### Control Flow
- `repeat n do: ... end` - Repeat commands n times
### Misc
- `print value` - Print to console
- `wait n` - Wait n milliseconds
- `stop` - Stop execution
## Usage
1. Write Shrimp/LOGO code in the editor
2. Press **Run** (or Cmd+Enter) to execute
3. Watch the turtle draw on the canvas
Example - Draw a square:
```shrimp
repeat 4 do:
forward 100
right 90
end
```