|| 'INSTRUCTIONS' you can move using the WASD keys! '@include' ( lib/rpn.nv lib/platforms/browser_dom.nv lib/platforms/browser_game.nv ) 'snake' 200 200 '' start a 400 by 400 game | '' game loop | '' . check if w is pressed . check if a is pressed . check if s is pressed . check if d is pressed . draw background . draw snake . next frame | 'key pressed' w | 'vector' + 0 - 1 | 'key pressed' a | 'vector' - 1 + 0 | 'key pressed' s | 'vector' + 0 + 1 | 'key pressed' d | 'vector' + 1 + 0 | 'snake' $x $y 'vector' $1 $2 $3 $4 | '' move snake '@rpn' ($y $4 $3 $x $2 $1) | '' move snake '@rpn data' ($x $y) | 'snake' $x $y | '' draw background | '@graphics' clear black | '' draw snake 'snake' $x $y? | '@graphics' draw square $x $y 10 green | '@graphics' draw square $x $y $size $color '@@canvas context' $context? | '@js' $context.fillStyle = $color; $context.fillRect($x, $y, $size, $size); | '' start a $x by $y game | '@graphics' . canvas init canvas . set-resolution _ $x $y 'DOM' ( > ) '' game loop | '' next frame | '@js' window.requestAnimationFrame(nextFrame); || '@js' const nextFrame = () => { f("", "game", "loop"); me.run(); }