Morpion solitaire: Difference between revisions

→‎{{header|Wren}}: Minor tidy and fixed problem with 'mvprintw' now requiring a format specifier.
m (→‎{{header|Perl}}: future-proof for 5.36, use new bitwise string operator)
(→‎{{header|Wren}}: Minor tidy and fixed problem with 'mvprintw' now requiring a format specifier.)
 
Line 1,689:
{{libheader|Wren-fmt}}
An embedded program so we can use the ncurses library.
<syntaxhighlight lang="ecmascriptwren">/* morpion_solitaireMorpion_solitaire.wren */
 
import "random" for Random
Line 1,933:
<br>
We now embed the above script in the following C program, build and run it.
<syntaxhighlight lang="c">/* gcc morpion_solitaireMorpion_solitaire.c -o morpion_solitaireMorpion_solitaire -lncurses -lwren -lm */
 
#include <stdio.h>
Line 1,977:
int x = (int)wrenGetSlotDouble(vm, 2);
const char *str = wrenGetSlotString(vm, 3);
mvprintw(y, x, "%s", str);
}
 
Line 2,074:
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "morpion_solitaireMorpion_solitaire.wren";
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
9,476

edits