Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 766 Bytes

README.org

File metadata and controls

42 lines (32 loc) · 766 Bytes

PureScript Free Turtle interpreter

A simple Turtle graphics system implemented using a Free monad, intended for educational purposes. It comes with an interpreter that translates programs in the Turtle language to HTML canvas graphics.

img/two-stars.png

main :: Effect Context2D
main = CanvasInterpreter.render "turtleCanvas" do
  color Purple
  star

  forward 40.0
  left 100.0

  color Red
  star

star = do
  penDown
  right 144.0
  forward 100.0
  right 144.0
  forward 100.0
  right 144.0
  forward 100.0
  right 144.0
  forward 100.0
  right 144.0
  forward 100.0
  penUp

Usage

In your shell, type:

npm install
npm run build
npm run bundle

Then point your browser to ./html/index.html.