CLI-based maze-game: Difference between revisions

m
m (→‎{{header|Julia}}: help display change)
m (→‎{{header|Wren}}: Minor tidy)
 
(One intermediate revision by one other user not shown)
Line 1,060:
 
function play()
print(Crayon(background=(0,0,0), foreground=(250,250,250))) # white on black
Screen.clear!(Screen.All())
game = Game()
Line 2,540 ⟶ 2,541:
{{libheader|Wren-iterate}}
An embedded script so we can use the ncurses library.
<syntaxhighlight lang="ecmascriptwren">/* cli_based_maze_gameCLI-based_maze_game.wren */
 
import "./dynamic" for Enum, Tuple, Struct
Line 2,959 ⟶ 2,960:
<br>
We now embed this in the following C program, build and run it.
<syntaxhighlight lang="c">/* gcc cli_based_maze_gameCLI-based_maze_game.c -o cli_based_maze_gameCLI-based_maze_game -lncurses -lwren -lm */
 
#include <stdio.h>
Line 3,120 ⟶ 3,121:
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "cli_based_maze_gameCLI-based_maze_game.wren";
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
9,486

edits