Snake: Difference between revisions
m
→{{header|EasyLang}}
(One intermediate revision by one other user not shown) | |||
Line 2,295:
[https://easylang.dev/apps/snake.html Run it]
{{Trans|Craft Basic}}
<syntaxhighlight
subr fruit
rx = (
ry = (
.
subr start
Line 2,305:
sx[] = [ 52.5 0 0 0 0 ]
sy[] = [ 52.5 0 0 0 0 ]
dir =
timer 0
.
Line 2,318:
move 6 30
text "Space or click to to start"
#
on key
if game = 0 and keybkey = " "
Line 2,365:
move rx ry
circle 1.5
#
sx = sx[1] ; sy = sy[1]
if dir = 1
Line 5,120:
{{libheader|Wren-dynamic}}
An embedded program so we can ask the C host to call ncurses and another library function for us.
<syntaxhighlight lang="
import "random" for Random
Line 5,258:
<br>
Now embed this script in the following C program, compile and run it.
<syntaxhighlight lang="c">/* gcc
#include <stdio.h>
Line 5,404:
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
|