๐งช Playground
A full OCaml 5.5 session in your browser, with the course
Gamekit preloaded (Draw, Anim, Input,
Game). Definitions persist between runs until you reset.
Ctrl+Enter runs.
Notes
- The canvas is 400ร300;
(0,0)is the top-left corner and y grows down. - Colors are CSS strings:
"red","#1e90ff","rgb(255 200 0)"โฆ - For keyboard examples: click the page first, then hold a key.
- An infinite loop freezes the tab (the engine shares your page's thread) โ reload if it happens; your code is autosaved.
- Effects work here (the engine is compiled with effect support);
Domain.spawndoes not โ browsers are single-threaded. That's what lesson 4.3 and your real machine are for.
What exactly is preloaded? (the Gamekit source)
This OCaml is evaluated into your session before your code โ it's also a nice read once you reach Phase 3: