Robots/Wren: Difference between revisions

Content added Content deleted
(→‎Code: Sharper colors.)
m (→‎Code: Fixed syntax highlighting.)
Line 1: Line 1:
==Code==
===Code===
{{trans|Go}}
{{trans|Go}}
{{libheader|ncurses}}
{{libheader|ncurses}}
Line 7: Line 7:
{{works with|Ubuntu 20.04}}
{{works with|Ubuntu 20.04}}
An embedded script so we can use the ncurses library.
An embedded script so we can use the ncurses library.
<lang ecmascript>/* robots.wren */
<syntaxhighlight lang="ecmascript">/* robots.wren */


import "./dynamic" for Struct
import "./dynamic" for Struct
Line 298: Line 298:
NC.echo()
NC.echo()
NC.endwin()
NC.endwin()
NC.cursSet(1)</lang>
NC.cursSet(1)</syntaxhighlight>
<br>
<br>
We now embed this in the following C program, build and run it.
We now embed this in the following C program, build and run it.
<lang c>/* gcc robots.c -o robots -lncurses -lwren -lm */
<syntaxhighlight lang="c">/* gcc robots.c -o robots -lncurses -lwren -lm */


#include <stdio.h>
#include <stdio.h>
Line 519: Line 519:
free(script);
free(script);
return 0;
return 0;
}</lang>
}</syntaxhighlight>