Skip to content

Commit 1fa1697

Browse files
committed
Adjust exec conventions
1 parent c52547a commit 1fa1697

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

bin/tsnode

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@
99
# https://github.com/TypeStrong/ts-node/issues/935#issuecomment-582673034
1010
#
1111

12-
1312
node --loader @k-foss/ts-esnode --experimental-specifier-resolution=node $@

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"train": "bin/tsnode src/net/train.js",
1313
"test-model": "node src/net/check_model.js",
1414
"tsc": "tsc",
15-
"test": "mocha --require ts-node/register src/**/*.spec.ts"
15+
"test": "bin/tsnode node_modules/mocha/bin/_mocha src/**/*.spec.ts"
1616
},
1717
"keywords": [
1818
"snake",

src/net/sim.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {worldToVector} from './worldToVector'
1111
const width = 20;
1212
const height = 20;
1313

14-
1514
const render = (world: IWorld) => {
1615
const { width } = world;
1716
const inputVector = worldToVector(world);
@@ -23,9 +22,10 @@ const render = (world: IWorld) => {
2322
}
2423
}
2524
}
26-
const world = createWorld(width, height);
2725

28-
const playGame = async function() {
26+
process.env.NODE && (async() => {
27+
const world = createWorld(width, height);
28+
2929
let alive = true;
3030
while (alive) {
3131
render(world);
@@ -35,9 +35,4 @@ const playGame = async function() {
3535
world.player.headed = arrowKeys[direction];
3636
await sleep(500);
3737
}
38-
39-
};
40-
41-
if (process.env.NODE) {
42-
playGame();
43-
}
38+
})();

0 commit comments

Comments
 (0)