Greed/Wren: Difference between revisions

Content added Content deleted
(Added code.)
 
m (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>/* greed.wren */
<syntaxhighlight lang="ecmascript">/* greed.wren */


import "./dynamic" for Struct
import "./dynamic" for Struct
Line 216: Line 216:
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 greed.c -o greed -lncurses -lwren -lm */
<syntaxhighlight lang="c">/* gcc greed.c -o greed -lncurses -lwren -lm */


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