Installed

elm/browser
1.0.2
elm/core
1.0.5
elm/html
1.0.0
evancz/elm-playground
1.0.3

Registry

elm/http
2.0.0
elm/random
1.0.0
elm/time
1.0.0
elm/file
1.0.5
elm/json
1.1.3
elm/svg
1.0.1
elm-explorations/webgl
1.1.3
w0rm/elm-physics
5.1.3
rtfeldman/elm-css
18.0.0
mdgriffith/elm-ui
1.1.8
​x
 
1
-- Use arrow keys to move the turtle around.
2
--
3
-- Forward with UP and turn with LEFT and RIGHT.
4
--
5
-- Learn more about the playground here:
6
--   https://package.elm-lang.org/packages/evancz/elm-playground/latest/
7
--
8
​
9
import Playground exposing (..)
10
​
11
​
12
main =
13
  game view update
14
    { x = 0
15
    , y = 0
16
    , angle = 0
17
    }
18
​
19
​
20
view computer turtle =
21
  [ rectangle blue computer.screen.width computer.screen.height
22
  , image 96 96 "https://elm-lang.org/images/turtle.gif"
23
      |> move turtle.x turtle.y
24
      |> rotate turtle.angle
25
  ]
26
​
27
​
28
update computer turtle =
29
  { x = turtle.x + toY computer.keyboard * cos (degrees turtle.angle)
30
  , y = turtle.y + toY computer.keyboard * sin (degrees turtle.angle)
31
  , angle = turtle.angle - toX computer.keyboard
32
  }