@pkmn/engine 0.1.0-dev.2c13d3ec → 0.1.0-dev.2c426670
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -3
- package/README.md +85 -52
- package/build/pkg/addon.js +6 -7
- package/build/pkg/addon.js.map +1 -1
- package/build/pkg/data/ids.json +12 -12
- package/build/pkg/data/layout.json +2 -2
- package/build/pkg/data/protocol.json +69 -12
- package/build/pkg/data.d.ts +4 -4
- package/build/pkg/data.js.map +1 -1
- package/build/pkg/gen1.js +2 -2
- package/build/pkg/gen1.js.map +1 -1
- package/build/pkg/index.d.ts +2 -1
- package/build/pkg/index.js.map +1 -1
- package/build/pkg/protocol.js +61 -42
- package/build/pkg/protocol.js.map +1 -1
- package/build/test/display.js +8 -3
- package/build/test/display.js.map +1 -1
- package/build/tools/debug.js +5 -4
- package/build/tools/debug.js.map +1 -1
- package/build.zig +135 -128
- package/package.json +54 -25
- package/src/bin/install-pkmn-engine +27 -19
- package/src/lib/common/battle.zig +17 -0
- package/src/lib/common/data.zig +12 -24
- package/src/lib/common/debug.zig +2 -2
- package/src/lib/common/js.zig +118 -0
- package/src/lib/common/optional.zig +67 -0
- package/src/lib/common/options.zig +2 -0
- package/src/lib/common/protocol.zig +805 -327
- package/src/lib/common/rational.zig +447 -0
- package/src/lib/common/rng.zig +26 -17
- package/src/lib/common/util.zig +12 -0
- package/src/lib/gen1/calc.zig +831 -0
- package/src/lib/gen1/chance.zig +994 -0
- package/src/lib/gen1/data/moves.zig +192 -180
- package/src/lib/gen1/data/species.zig +3 -3
- package/src/lib/gen1/data/types.zig +7 -7
- package/src/lib/gen1/data.zig +63 -70
- package/src/lib/gen1/helpers.zig +87 -395
- package/src/lib/gen1/mechanics.zig +571 -544
- package/src/lib/gen2/calc.zig +143 -0
- package/src/lib/gen2/chance.zig +882 -0
- package/src/lib/gen2/data/items.zig +12 -18
- package/src/lib/gen2/data/moves.zig +663 -569
- package/src/lib/gen2/data/species.zig +1 -1
- package/src/lib/gen2/data/types.zig +134 -31
- package/src/lib/gen2/data.zig +106 -79
- package/src/lib/gen2/generated.zig +806 -0
- package/src/lib/gen2/helpers.zig +45 -19
- package/src/lib/gen2/mechanics.zig +3560 -9
- package/src/lib/{binding/node.zig → node.zig} +10 -13
- package/src/lib/pkmn.zig +27 -12
- package/src/lib/{binding/wasm.zig → wasm.zig} +2 -1
- package/src/test/display/pkmn.html.tmpl +5 -5
- package/src/lib/gen1/README.md +0 -814
- package/src/lib/gen2/README.md +0 -309
package/build/tools/debug.js
CHANGED
|
@@ -23,7 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.display = display;
|
|
27
|
+
exports.run = run;
|
|
27
28
|
const fs = __importStar(require("fs"));
|
|
28
29
|
const data_1 = require("@pkmn/data");
|
|
29
30
|
const pkg_1 = require("../pkg");
|
|
@@ -60,6 +61,8 @@ function display(gens, data, error, seed) {
|
|
|
60
61
|
let offset = 0;
|
|
61
62
|
const showdown = !!view.getUint8(offset++);
|
|
62
63
|
const gen = gens.get(view.getUint8(offset++));
|
|
64
|
+
const N = view.getUint16(offset, data_2.LE);
|
|
65
|
+
offset += 2;
|
|
63
66
|
const lookup = data_2.Lookup.get(gen);
|
|
64
67
|
const size = data_2.LAYOUT[gen.num - 1].sizes.Battle;
|
|
65
68
|
const deserialize = (buf) => {
|
|
@@ -83,7 +86,7 @@ function display(gens, data, error, seed) {
|
|
|
83
86
|
partial.parsed.push(r.value);
|
|
84
87
|
r = it.next();
|
|
85
88
|
}
|
|
86
|
-
offset += r.value;
|
|
89
|
+
offset += N || r.value;
|
|
87
90
|
if (offset >= view.byteLength)
|
|
88
91
|
break;
|
|
89
92
|
partial.battle = deserialize(data.subarray(offset, offset += size));
|
|
@@ -101,7 +104,6 @@ function display(gens, data, error, seed) {
|
|
|
101
104
|
}
|
|
102
105
|
return (0, display_1.render)(gen, showdown, error, seed, frames, partial);
|
|
103
106
|
}
|
|
104
|
-
exports.display = display;
|
|
105
107
|
async function run(gens) {
|
|
106
108
|
let input;
|
|
107
109
|
if (process.argv.length > 2) {
|
|
@@ -122,7 +124,6 @@ async function run(gens) {
|
|
|
122
124
|
}
|
|
123
125
|
process.stdout.write(display(gens, input));
|
|
124
126
|
}
|
|
125
|
-
exports.run = run;
|
|
126
127
|
if (require.main === module) {
|
|
127
128
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
128
129
|
run(new data_1.Generations(require('@pkmn/sim').Dex)).catch(err => {
|
package/build/tools/debug.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/tools/debug.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/tools/debug.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,0BAuDC;AAED,kBAkBC;AA/GD,uCAAyB;AAEzB,qCAAmD;AAEnD,gCAAmE;AACnE,oDAAsC;AACtC,sCAAqD;AACrD,kDAAoC;AACpC,6CAA8C;AAE9C,MAAM,YAAY;IAChB,GAAG,CAAa;IAChB,MAAM,CAAS;IAEf,YAAY,GAAe,EAAE,MAAc;QACzC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,IAAI,EAAE;QACJ,MAAM,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC3C,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC;aAChC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,G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}
|
package/build.zig
CHANGED
|
@@ -1,26 +1,6 @@
|
|
|
1
1
|
const std = @import("std");
|
|
2
2
|
const builtin = @import("builtin");
|
|
3
3
|
|
|
4
|
-
pub const Options = struct {
|
|
5
|
-
showdown: ?bool = null,
|
|
6
|
-
log: ?bool = null,
|
|
7
|
-
chance: ?bool = null,
|
|
8
|
-
calc: ?bool = null,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
pub fn module(b: *std.Build, options: Options) *std.Build.Module {
|
|
12
|
-
const dirname = comptime std.fs.path.dirname(@src().file) orelse ".";
|
|
13
|
-
const build_options = b.addOptions();
|
|
14
|
-
build_options.addOption(?bool, "showdown", options.showdown);
|
|
15
|
-
build_options.addOption(?bool, "log", options.log);
|
|
16
|
-
build_options.addOption(?bool, "chance", options.chance);
|
|
17
|
-
build_options.addOption(?bool, "calc", options.calc);
|
|
18
|
-
return b.createModule(.{
|
|
19
|
-
.source_file = .{ .path = dirname ++ "/src/lib/pkmn.zig" },
|
|
20
|
-
.dependencies = &.{.{ .name = "build_options", .module = build_options.createModule() }},
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
4
|
pub fn build(b: *std.Build) !void {
|
|
25
5
|
const target = b.standardTargetOptions(.{});
|
|
26
6
|
const optimize = b.standardOptimizeOption(.{});
|
|
@@ -32,9 +12,10 @@ pub fn build(b: *std.Build) !void {
|
|
|
32
12
|
const wasm_stack_size =
|
|
33
13
|
b.option(u64, "wasm-stack-size", "The size of WASM stack") orelse std.wasm.page_size;
|
|
34
14
|
const dynamic = b.option(bool, "dynamic", "Build a dynamic library") orelse false;
|
|
35
|
-
const strip = b.option(bool, "strip", "Strip debugging symbols from binary")
|
|
36
|
-
const pic = b.option(bool, "pic", "Force position independent code")
|
|
15
|
+
const strip = b.option(bool, "strip", "Strip debugging symbols from binary");
|
|
16
|
+
const pic = b.option(bool, "pic", "Force position independent code");
|
|
37
17
|
const emit_asm = b.option(bool, "emit-asm", "Output .s (assembly code)") orelse false;
|
|
18
|
+
const emit_ll = b.option(bool, "emit-ll", "Output .ll (LLVM IR)") orelse false;
|
|
38
19
|
|
|
39
20
|
const cmd = b.findProgram(&.{"strip"}, &.{}) catch null;
|
|
40
21
|
|
|
@@ -43,7 +24,7 @@ pub fn build(b: *std.Build) !void {
|
|
|
43
24
|
defer parsed.deinit();
|
|
44
25
|
const version = parsed.value.object.get("version").?.string;
|
|
45
26
|
const description = parsed.value.object.get("description").?.string;
|
|
46
|
-
var repository = std.mem.
|
|
27
|
+
var repository = std.mem.splitSequence(u8, parsed.value.object.get("repository").?.string, ":");
|
|
47
28
|
std.debug.assert(std.mem.eql(u8, repository.first(), "github"));
|
|
48
29
|
|
|
49
30
|
const showdown =
|
|
@@ -60,30 +41,37 @@ pub fn build(b: *std.Build) !void {
|
|
|
60
41
|
|
|
61
42
|
const name = if (showdown) "pkmn-showdown" else "pkmn";
|
|
62
43
|
|
|
44
|
+
const module = b.addModule("pkmn", .{
|
|
45
|
+
.root_source_file = b.path("src/lib/pkmn.zig"),
|
|
46
|
+
.optimize = optimize,
|
|
47
|
+
.target = target,
|
|
48
|
+
.imports = &.{.{ .name = "build_options", .module = options.createModule() }},
|
|
49
|
+
});
|
|
50
|
+
|
|
63
51
|
var c = false;
|
|
64
52
|
if (node_headers) |headers| {
|
|
65
53
|
const addon = b.fmt("{s}.node", .{name});
|
|
66
54
|
const lib = b.addSharedLibrary(.{
|
|
67
55
|
.name = addon,
|
|
68
|
-
.root_source_file = .
|
|
56
|
+
.root_source_file = b.path("src/lib/node.zig"),
|
|
69
57
|
.optimize = optimize,
|
|
70
58
|
.target = target,
|
|
59
|
+
.strip = strip,
|
|
60
|
+
.pic = pic,
|
|
71
61
|
});
|
|
72
|
-
lib.addOptions("build_options", options);
|
|
73
|
-
lib.
|
|
74
|
-
lib.addSystemIncludePath(headers);
|
|
62
|
+
lib.root_module.addOptions("build_options", options);
|
|
63
|
+
lib.addSystemIncludePath(b.path(headers));
|
|
75
64
|
lib.linkLibC();
|
|
76
65
|
if (node_import_lib) |il| {
|
|
77
|
-
lib.addObjectFile(il);
|
|
78
|
-
} else if (
|
|
66
|
+
lib.addObjectFile(b.path(il));
|
|
67
|
+
} else if (target.result.os.tag == .windows) {
|
|
79
68
|
try std.io.getStdErr().writeAll("Must provide --node-import-library path on Windows\n");
|
|
80
69
|
std.process.exit(1);
|
|
81
70
|
}
|
|
82
71
|
lib.linker_allow_shlib_undefined = true;
|
|
83
72
|
maybeStrip(b, lib, b.getInstallStep(), strip, cmd);
|
|
84
|
-
if (pic) lib.force_pic = pic;
|
|
85
73
|
// Always emit to build/lib because this is where the driver code expects to find it
|
|
86
|
-
// TODO
|
|
74
|
+
// TODO: ziglang/zig#2231 - using the following used to work (though was hacky):
|
|
87
75
|
//
|
|
88
76
|
// lib.emit_bin = .{ .emit_to = b.fmt("build/lib/{s}", .{addon}) };
|
|
89
77
|
// b.getInstallStep().dependOn(&lib.step);
|
|
@@ -92,74 +80,101 @@ pub fn build(b: *std.Build) !void {
|
|
|
92
80
|
// rename the file ourself in install-pkmn-engine
|
|
93
81
|
b.installArtifact(lib);
|
|
94
82
|
} else if (wasm) {
|
|
95
|
-
const
|
|
83
|
+
const exe = b.addExecutable(.{
|
|
96
84
|
.name = name,
|
|
97
|
-
.root_source_file = .
|
|
85
|
+
.root_source_file = b.path("src/lib/wasm.zig"),
|
|
98
86
|
.optimize = switch (optimize) {
|
|
99
87
|
.ReleaseFast, .ReleaseSafe => .ReleaseSmall,
|
|
100
88
|
else => optimize,
|
|
101
89
|
},
|
|
102
|
-
.target = .{ .cpu_arch = .wasm32, .os_tag = .freestanding },
|
|
90
|
+
.target = b.resolveTargetQuery(.{ .cpu_arch = .wasm32, .os_tag = .freestanding }),
|
|
91
|
+
.strip = strip,
|
|
92
|
+
.pic = pic,
|
|
103
93
|
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
94
|
+
exe.root_module.addOptions("build_options", options);
|
|
95
|
+
exe.root_module.export_symbol_names = &[_][]const u8{
|
|
96
|
+
"SHOWDOWN",
|
|
97
|
+
"LOG",
|
|
98
|
+
"CHANCE",
|
|
99
|
+
"CALC",
|
|
100
|
+
"GEN1_CHOICES_SIZE",
|
|
101
|
+
"GEN1_LOGS_SIZE",
|
|
102
|
+
};
|
|
103
|
+
exe.entry = .disabled;
|
|
104
|
+
exe.stack_size = wasm_stack_size;
|
|
110
105
|
const opt = b.findProgram(&.{"wasm-opt"}, &.{"./node_modules/.bin"}) catch null;
|
|
111
106
|
if (optimize != .Debug and opt != null) {
|
|
112
107
|
const out = b.fmt("build/lib/{s}.wasm", .{name});
|
|
113
108
|
const sh = b.addSystemCommand(&.{ opt.?, "-O4" });
|
|
114
|
-
sh.addArtifactArg(
|
|
109
|
+
sh.addArtifactArg(exe);
|
|
115
110
|
sh.addArg("-o");
|
|
116
|
-
sh.
|
|
111
|
+
sh.addFileArg(b.path(out));
|
|
117
112
|
b.getInstallStep().dependOn(&sh.step);
|
|
113
|
+
} else {
|
|
114
|
+
b.getInstallStep().dependOn(&b.addInstallArtifact(exe, .{
|
|
115
|
+
.dest_dir = .{ .override = std.Build.InstallDir{ .lib = {} } },
|
|
116
|
+
}).step);
|
|
118
117
|
}
|
|
119
|
-
b.installArtifact(lib);
|
|
120
118
|
} else if (dynamic) {
|
|
121
119
|
const lib = b.addSharedLibrary(.{
|
|
122
120
|
.name = name,
|
|
123
|
-
.root_source_file = .
|
|
121
|
+
.root_source_file = b.path("src/lib/c.zig"),
|
|
124
122
|
.version = try std.SemanticVersion.parse(version),
|
|
125
123
|
.optimize = optimize,
|
|
126
124
|
.target = target,
|
|
125
|
+
.strip = strip,
|
|
126
|
+
.pic = pic,
|
|
127
127
|
});
|
|
128
|
-
lib.addOptions("build_options", options);
|
|
129
|
-
lib.
|
|
130
|
-
lib.addIncludePath("src/include");
|
|
128
|
+
lib.root_module.addOptions("build_options", options);
|
|
129
|
+
lib.addIncludePath(b.path("src/include"));
|
|
131
130
|
maybeStrip(b, lib, b.getInstallStep(), strip, cmd);
|
|
132
|
-
if (pic) lib.force_pic = pic;
|
|
133
131
|
b.installArtifact(lib);
|
|
134
132
|
c = true;
|
|
135
133
|
} else {
|
|
136
134
|
const lib = b.addStaticLibrary(.{
|
|
137
135
|
.name = name,
|
|
138
|
-
.root_source_file = .
|
|
136
|
+
.root_source_file = b.path("src/lib/c.zig"),
|
|
139
137
|
.optimize = optimize,
|
|
140
138
|
.target = target,
|
|
139
|
+
.strip = strip,
|
|
140
|
+
.pic = pic,
|
|
141
141
|
});
|
|
142
|
-
lib.addOptions("build_options", options);
|
|
143
|
-
lib.
|
|
144
|
-
lib.addIncludePath("src/include");
|
|
142
|
+
lib.root_module.addOptions("build_options", options);
|
|
143
|
+
lib.addIncludePath(b.path("src/include"));
|
|
145
144
|
lib.bundle_compiler_rt = true;
|
|
146
145
|
maybeStrip(b, lib, b.getInstallStep(), strip, cmd);
|
|
147
|
-
if (
|
|
148
|
-
|
|
146
|
+
if (emit_asm) {
|
|
147
|
+
b.getInstallStep().dependOn(&b.addInstallFileWithDir(
|
|
148
|
+
lib.getEmittedAsm(),
|
|
149
|
+
.prefix,
|
|
150
|
+
b.fmt("{s}.s", .{name}),
|
|
151
|
+
).step);
|
|
152
|
+
}
|
|
153
|
+
if (emit_ll) {
|
|
154
|
+
b.getInstallStep().dependOn(&b.addInstallFileWithDir(
|
|
155
|
+
lib.getEmittedLlvmIr(),
|
|
156
|
+
.prefix,
|
|
157
|
+
b.fmt("{s}.ll", .{name}),
|
|
158
|
+
).step);
|
|
159
|
+
}
|
|
149
160
|
b.installArtifact(lib);
|
|
150
161
|
c = true;
|
|
151
162
|
}
|
|
152
163
|
|
|
153
164
|
if (c) {
|
|
154
165
|
const header = b.addInstallFileWithDir(
|
|
155
|
-
.
|
|
166
|
+
b.path("src/include/pkmn.h"),
|
|
156
167
|
.header,
|
|
157
168
|
"pkmn.h",
|
|
158
169
|
);
|
|
159
170
|
b.getInstallStep().dependOn(&header.step);
|
|
160
171
|
|
|
161
172
|
const pc = b.fmt("lib{s}.pc", .{name});
|
|
162
|
-
const file = try
|
|
173
|
+
const file = try std.fs.path.relative(
|
|
174
|
+
b.allocator,
|
|
175
|
+
try std.process.getCwdAlloc(b.allocator),
|
|
176
|
+
try b.cache_root.join(b.allocator, &.{pc}),
|
|
177
|
+
);
|
|
163
178
|
const pkgconfig_file = try std.fs.cwd().createFile(file, .{});
|
|
164
179
|
|
|
165
180
|
const dirname = comptime std.fs.path.dirname(@src().file) orelse ".";
|
|
@@ -192,14 +207,10 @@ pub fn build(b: *std.Build) !void {
|
|
|
192
207
|
// TODO: tests can be run multiple times due to @imports
|
|
193
208
|
const tests = TestStep.create(b, options, config);
|
|
194
209
|
|
|
195
|
-
var exes = std.ArrayList(*std.Build.
|
|
210
|
+
var exes = std.ArrayList(*std.Build.Step.Compile).init(b.allocator);
|
|
196
211
|
const tools: ToolConfig = .{
|
|
197
|
-
.
|
|
198
|
-
|
|
199
|
-
.log = log,
|
|
200
|
-
.chance = chance,
|
|
201
|
-
.calc = calc,
|
|
202
|
-
},
|
|
212
|
+
.showdown = showdown,
|
|
213
|
+
.module = module,
|
|
203
214
|
.general = config,
|
|
204
215
|
.tool = .{
|
|
205
216
|
.tests = if (tests.build) tests else null,
|
|
@@ -210,41 +221,42 @@ pub fn build(b: *std.Build) !void {
|
|
|
210
221
|
var benchmark_config = tools;
|
|
211
222
|
benchmark_config.general.optimize = .ReleaseFast;
|
|
212
223
|
benchmark_config.general.strip = true;
|
|
213
|
-
const benchmark = tool(b, "src/test/benchmark.zig", benchmark_config);
|
|
224
|
+
const benchmark = try tool(b, "src/test/benchmark.zig", benchmark_config);
|
|
214
225
|
|
|
215
226
|
var fuzz_config = tools;
|
|
216
227
|
fuzz_config.general.strip = false;
|
|
217
228
|
fuzz_config.tool.name = "fuzz";
|
|
218
|
-
const fuzz = tool(b, "src/test/fuzz.zig", fuzz_config);
|
|
219
|
-
|
|
220
|
-
const
|
|
221
|
-
const
|
|
222
|
-
const transitions = tool(b, "src/tools/transitions.zig", tools);
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
if (
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
b.step("
|
|
230
|
-
b.step("
|
|
231
|
-
b.step("
|
|
232
|
-
b.step("
|
|
233
|
-
b.step("serde", "Run serialization/deserialization tool").dependOn(&
|
|
229
|
+
const fuzz = try tool(b, "src/test/fuzz.zig", fuzz_config);
|
|
230
|
+
|
|
231
|
+
const analyze = try tool(b, "src/tools/analyze.zig", tools);
|
|
232
|
+
const dump = try tool(b, "src/tools/dump.zig", tools);
|
|
233
|
+
const transitions = try tool(b, "src/tools/transitions.zig", tools);
|
|
234
|
+
|
|
235
|
+
// FIXME: serde randomly fails to build in some release configurations
|
|
236
|
+
var hack = tools;
|
|
237
|
+
if (optimize != .Debug) hack.tool.tests = null;
|
|
238
|
+
const serde = try tool(b, "src/tools/serde.zig", hack);
|
|
239
|
+
|
|
240
|
+
if (analyze) |t| b.step("analyze", "Run LLVM analysis tool").dependOn(&t.step);
|
|
241
|
+
if (benchmark) |t| b.step("benchmark", "Run benchmark code").dependOn(&t.step);
|
|
242
|
+
if (dump) |t| b.step("dump", "Run protocol dump tool").dependOn(&t.step);
|
|
243
|
+
if (fuzz) |t| b.step("fuzz", "Run fuzz tester").dependOn(&t.step);
|
|
244
|
+
if (serde) |t| b.step("serde", "Run serialization/deserialization tool").dependOn(&t.step);
|
|
234
245
|
b.step("test", "Run all tests").dependOn(&tests.step);
|
|
235
246
|
b.step("tools", "Install tools").dependOn(&ToolsStep.create(b, &exes).step);
|
|
236
|
-
|
|
247
|
+
if (transitions) |t| {
|
|
248
|
+
b.step("transitions", "Visualize transitions algorithm search").dependOn(&t.step);
|
|
249
|
+
}
|
|
237
250
|
}
|
|
238
251
|
|
|
239
252
|
fn maybeStrip(
|
|
240
253
|
b: *std.Build,
|
|
241
|
-
artifact: *std.Build.
|
|
254
|
+
artifact: *std.Build.Step.Compile,
|
|
242
255
|
step: *std.Build.Step,
|
|
243
|
-
strip: bool,
|
|
256
|
+
strip: ?bool,
|
|
244
257
|
cmd: ?[]const u8,
|
|
245
258
|
) void {
|
|
246
|
-
|
|
247
|
-
if (!strip or cmd == null) return;
|
|
259
|
+
if (!(strip orelse false) or cmd == null) return;
|
|
248
260
|
// Using `strip -r -u` for dynamic libraries is supposed to work on macOS but doesn't...
|
|
249
261
|
const mac = builtin.os.tag == .macos;
|
|
250
262
|
if (mac and artifact.isDynamicLibrary()) return;
|
|
@@ -256,83 +268,78 @@ fn maybeStrip(
|
|
|
256
268
|
}
|
|
257
269
|
|
|
258
270
|
const Config = struct {
|
|
259
|
-
target: std.
|
|
271
|
+
target: std.Build.ResolvedTarget,
|
|
260
272
|
optimize: std.builtin.OptimizeMode,
|
|
261
|
-
pic: bool,
|
|
262
|
-
strip: bool,
|
|
273
|
+
pic: ?bool,
|
|
274
|
+
strip: ?bool,
|
|
263
275
|
cmd: ?[]const u8,
|
|
264
276
|
};
|
|
265
277
|
|
|
266
|
-
const TESTS = .{
|
|
267
|
-
"src/lib/common/test.zig",
|
|
268
|
-
"src/lib/gen1/test.zig",
|
|
269
|
-
"src/lib/gen2/test.zig",
|
|
270
|
-
};
|
|
271
|
-
|
|
272
278
|
const TestStep = struct {
|
|
273
279
|
step: std.Build.Step,
|
|
274
280
|
build: bool,
|
|
275
281
|
|
|
276
|
-
pub fn create(b: *std.Build, options: *std.Build.
|
|
282
|
+
pub fn create(b: *std.Build, options: *std.Build.Step.Options, config: Config) *TestStep {
|
|
277
283
|
const coverage = b.option([]const u8, "test-coverage", "Generate test coverage");
|
|
278
|
-
const test_file = b.option([]const u8, "test-file", "Input file for test");
|
|
279
284
|
const test_filter =
|
|
280
285
|
b.option([]const u8, "test-filter", "Skip tests that do not match filter");
|
|
281
286
|
|
|
282
287
|
const self = b.allocator.create(TestStep) catch @panic("OOM");
|
|
283
288
|
const step = std.Build.Step.init(.{ .id = .custom, .name = "Run all tests", .owner = b });
|
|
284
|
-
self.* =
|
|
285
|
-
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
tests.
|
|
299
|
-
maybeStrip(b, tests, &tests.step, config.strip, config.cmd);
|
|
300
|
-
if (config.pic) tests.force_pic = config.pic;
|
|
301
|
-
if (coverage) |c| {
|
|
302
|
-
tests.setExecCmd(&.{ "kcov", "--include-pattern=src/lib", c, null });
|
|
303
|
-
}
|
|
304
|
-
self.step.dependOn(&b.addRunArtifact(tests).step);
|
|
289
|
+
self.* = .{ .step = step, .build = test_filter == null };
|
|
290
|
+
|
|
291
|
+
const tests = b.addTest(.{
|
|
292
|
+
.root_source_file = b.path("src/lib/test.zig"),
|
|
293
|
+
.optimize = config.optimize,
|
|
294
|
+
.target = config.target,
|
|
295
|
+
.filter = test_filter,
|
|
296
|
+
.single_threaded = true,
|
|
297
|
+
.strip = config.strip,
|
|
298
|
+
.pic = config.pic,
|
|
299
|
+
});
|
|
300
|
+
tests.root_module.addOptions("build_options", options);
|
|
301
|
+
maybeStrip(b, tests, &tests.step, config.strip, config.cmd);
|
|
302
|
+
if (coverage) |c| {
|
|
303
|
+
tests.setExecCmd(&.{ "kcov", "--include-pattern=src/lib", c, null });
|
|
305
304
|
}
|
|
305
|
+
self.step.dependOn(&b.addRunArtifact(tests).step);
|
|
306
|
+
|
|
306
307
|
return self;
|
|
307
308
|
}
|
|
308
309
|
};
|
|
309
310
|
|
|
310
311
|
const ToolConfig = struct {
|
|
311
|
-
|
|
312
|
+
showdown: ?bool,
|
|
313
|
+
module: *std.Build.Module,
|
|
312
314
|
general: Config,
|
|
313
315
|
tool: struct {
|
|
314
316
|
tests: ?*TestStep,
|
|
315
317
|
name: ?[]const u8 = null,
|
|
316
|
-
exes: *std.ArrayList(*std.Build.
|
|
318
|
+
exes: *std.ArrayList(*std.Build.Step.Compile),
|
|
317
319
|
},
|
|
318
320
|
};
|
|
319
321
|
|
|
320
|
-
fn tool(b: *std.Build, path: []const u8, config: ToolConfig)
|
|
322
|
+
fn tool(b: *std.Build, path: []const u8, config: ToolConfig) !?*std.Build.Step.Run {
|
|
323
|
+
std.fs.cwd().access(path, .{}) catch |err| switch (err) {
|
|
324
|
+
error.FileNotFound => return null,
|
|
325
|
+
else => |e| return e,
|
|
326
|
+
};
|
|
321
327
|
var name = config.tool.name orelse std.fs.path.basename(path);
|
|
322
328
|
const index = std.mem.lastIndexOfScalar(u8, name, '.');
|
|
323
329
|
if (index) |i| name = name[0..i];
|
|
324
|
-
if (config.
|
|
330
|
+
if (config.showdown orelse false) name = b.fmt("{s}-showdown", .{name});
|
|
325
331
|
|
|
326
332
|
const exe = b.addExecutable(.{
|
|
327
333
|
.name = name,
|
|
328
|
-
.root_source_file = .
|
|
334
|
+
.root_source_file = b.path(path),
|
|
329
335
|
.target = config.general.target,
|
|
330
336
|
.optimize = config.general.optimize,
|
|
337
|
+
.single_threaded = true,
|
|
338
|
+
.strip = config.general.strip,
|
|
339
|
+
.pic = config.general.pic,
|
|
331
340
|
});
|
|
332
|
-
exe.
|
|
341
|
+
exe.root_module.addImport("pkmn", config.module);
|
|
333
342
|
|
|
334
|
-
exe.single_threaded = true;
|
|
335
|
-
if (config.general.pic) exe.force_pic = config.general.pic;
|
|
336
343
|
if (config.tool.tests) |ts| ts.step.dependOn(&exe.step);
|
|
337
344
|
config.tool.exes.append(exe) catch @panic("OOM");
|
|
338
345
|
|
|
@@ -346,11 +353,11 @@ fn tool(b: *std.Build, path: []const u8, config: ToolConfig) *std.Build.RunStep
|
|
|
346
353
|
const ToolsStep = struct {
|
|
347
354
|
step: std.Build.Step,
|
|
348
355
|
|
|
349
|
-
pub fn create(b: *std.Build, exes: *std.ArrayList(*std.Build.
|
|
356
|
+
pub fn create(b: *std.Build, exes: *std.ArrayList(*std.Build.Step.Compile)) *ToolsStep {
|
|
350
357
|
const self = b.allocator.create(ToolsStep) catch @panic("OOM");
|
|
351
358
|
const step = std.Build.Step.init(.{ .id = .custom, .name = "Install tools", .owner = b });
|
|
352
|
-
self.* =
|
|
353
|
-
for (exes.items) |t| self.step.dependOn(&b.addInstallArtifact(t).step);
|
|
359
|
+
self.* = .{ .step = step };
|
|
360
|
+
for (exes.items) |t| self.step.dependOn(&b.addInstallArtifact(t, .{}).step);
|
|
354
361
|
return self;
|
|
355
362
|
}
|
|
356
363
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pkmn/engine",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.2c426670",
|
|
4
4
|
"description": "A minimal, complete, Pokémon battle simulation engine optimized for performance",
|
|
5
5
|
"repository": "github:pkmn/engine",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,28 +31,37 @@
|
|
|
31
31
|
"build/test/display.js",
|
|
32
32
|
"build/tools/debug.js.map",
|
|
33
33
|
"build/tools/debug.js",
|
|
34
|
-
"src/
|
|
35
|
-
"src/lib/binding/node.zig",
|
|
36
|
-
"src/lib/binding/wasm.zig",
|
|
34
|
+
"src/lib/common/battle.zig",
|
|
37
35
|
"src/lib/common/data.zig",
|
|
38
36
|
"src/lib/common/debug.zig",
|
|
37
|
+
"src/lib/common/js.zig",
|
|
38
|
+
"src/lib/common/optional.zig",
|
|
39
39
|
"src/lib/common/options.zig",
|
|
40
40
|
"src/lib/common/protocol.zig",
|
|
41
|
+
"src/lib/common/rational.zig",
|
|
41
42
|
"src/lib/common/rng.zig",
|
|
43
|
+
"src/lib/common/util.zig",
|
|
44
|
+
"src/lib/gen1/calc.zig",
|
|
45
|
+
"src/lib/gen1/chance.zig",
|
|
42
46
|
"src/lib/gen1/data.zig",
|
|
43
47
|
"src/lib/gen1/data/moves.zig",
|
|
44
48
|
"src/lib/gen1/data/species.zig",
|
|
45
49
|
"src/lib/gen1/data/types.zig",
|
|
46
50
|
"src/lib/gen1/helpers.zig",
|
|
47
51
|
"src/lib/gen1/mechanics.zig",
|
|
52
|
+
"src/lib/gen2/calc.zig",
|
|
53
|
+
"src/lib/gen2/chance.zig",
|
|
48
54
|
"src/lib/gen2/data.zig",
|
|
49
55
|
"src/lib/gen2/data/items.zig",
|
|
50
56
|
"src/lib/gen2/data/moves.zig",
|
|
51
57
|
"src/lib/gen2/data/species.zig",
|
|
52
58
|
"src/lib/gen2/data/types.zig",
|
|
59
|
+
"src/lib/gen2/generated.zig",
|
|
53
60
|
"src/lib/gen2/helpers.zig",
|
|
54
61
|
"src/lib/gen2/mechanics.zig",
|
|
62
|
+
"src/lib/node.zig",
|
|
55
63
|
"src/lib/pkmn.zig",
|
|
64
|
+
"src/lib/wasm.zig",
|
|
56
65
|
"src/test/display/pkmn.html.tmpl"
|
|
57
66
|
],
|
|
58
67
|
"engines": {
|
|
@@ -66,30 +75,31 @@
|
|
|
66
75
|
"access": "public"
|
|
67
76
|
},
|
|
68
77
|
"dependencies": {
|
|
69
|
-
"@pkmn/data": "^0.
|
|
70
|
-
"@pkmn/protocol": "^0.6.
|
|
78
|
+
"@pkmn/data": "^0.9.11",
|
|
79
|
+
"@pkmn/protocol": "^0.6.25"
|
|
71
80
|
},
|
|
72
81
|
"devDependencies": {
|
|
73
|
-
"@pkmn/eslint-config": "^
|
|
74
|
-
"@pkmn/img": "^0.2.
|
|
75
|
-
"@pkmn/sets": "^5.
|
|
76
|
-
"@pkmn/sim": "0.
|
|
77
|
-
"@types/html-minifier": "^4.0.
|
|
78
|
-
"@types/jest": "^29.5.
|
|
79
|
-
"@types/minimist": "^1.2.
|
|
80
|
-
"@types/mustache": "^4.2.
|
|
81
|
-
"@types/node": "^
|
|
82
|
-
"@vitest/coverage-
|
|
83
|
-
"binaryen": "^
|
|
84
|
-
"eslint": "
|
|
82
|
+
"@pkmn/eslint-config": "^8.1.0",
|
|
83
|
+
"@pkmn/img": "^0.2.31",
|
|
84
|
+
"@pkmn/sets": "^5.1.2",
|
|
85
|
+
"@pkmn/sim": "0.9.11",
|
|
86
|
+
"@types/html-minifier": "^4.0.5",
|
|
87
|
+
"@types/jest": "^29.5.12",
|
|
88
|
+
"@types/minimist": "^1.2.5",
|
|
89
|
+
"@types/mustache": "^4.2.5",
|
|
90
|
+
"@types/node": "^22.0.2",
|
|
91
|
+
"@vitest/coverage-v8": "^2.0.5",
|
|
92
|
+
"binaryen": "^118.0.0",
|
|
93
|
+
"eslint": "<=8",
|
|
85
94
|
"html-minifier": "^4.0.0",
|
|
86
|
-
"json-stringify-pretty-compact": "
|
|
95
|
+
"json-stringify-pretty-compact": "4.0.0",
|
|
87
96
|
"minimist": "^1.2.8",
|
|
88
97
|
"mustache": "^4.2.0",
|
|
89
98
|
"source-map-support": "^0.5.21",
|
|
99
|
+
"table": "^6.8.2",
|
|
90
100
|
"trakr": "^0.2.0",
|
|
91
|
-
"typescript": "^5.
|
|
92
|
-
"vitest": "^0.
|
|
101
|
+
"typescript": "^5.5.4",
|
|
102
|
+
"vitest": "^2.0.5"
|
|
93
103
|
},
|
|
94
104
|
"scripts": {
|
|
95
105
|
"lint": "eslint --cache src --ext ts,js && eslint src/bin/*",
|
|
@@ -111,7 +121,7 @@
|
|
|
111
121
|
"ignorePatterns": [
|
|
112
122
|
"dist/",
|
|
113
123
|
"node_modules/",
|
|
114
|
-
"
|
|
124
|
+
"examples/zig",
|
|
115
125
|
"build/"
|
|
116
126
|
],
|
|
117
127
|
"env": {
|
|
@@ -127,10 +137,18 @@
|
|
|
127
137
|
"parserOptions": {
|
|
128
138
|
"project": [
|
|
129
139
|
"./tsconfig.json",
|
|
130
|
-
"./
|
|
140
|
+
"./examples/js/tsconfig.json"
|
|
131
141
|
]
|
|
132
142
|
}
|
|
133
143
|
},
|
|
144
|
+
{
|
|
145
|
+
"files": [
|
|
146
|
+
"src/test/display.ts"
|
|
147
|
+
],
|
|
148
|
+
"rules": {
|
|
149
|
+
"@typescript-eslint/no-unnecessary-type-assertion": "off"
|
|
150
|
+
}
|
|
151
|
+
},
|
|
134
152
|
{
|
|
135
153
|
"files": [
|
|
136
154
|
"src/pkg/index.ts",
|
|
@@ -140,7 +158,8 @@
|
|
|
140
158
|
"rules": {
|
|
141
159
|
"no-control-regex": "off",
|
|
142
160
|
"@typescript-eslint/no-empty-interface": "off",
|
|
143
|
-
"@typescript-eslint/no-shadow": "off"
|
|
161
|
+
"@typescript-eslint/no-shadow": "off",
|
|
162
|
+
"@typescript-eslint/no-unsafe-declaration-merging": "off"
|
|
144
163
|
}
|
|
145
164
|
},
|
|
146
165
|
{
|
|
@@ -156,7 +175,17 @@
|
|
|
156
175
|
"src/test/benchmark*.ts"
|
|
157
176
|
],
|
|
158
177
|
"rules": {
|
|
159
|
-
"@typescript-eslint/no-unused-vars": "off"
|
|
178
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
179
|
+
"@typescript-eslint/no-redundant-type-constituents": "off"
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"files": [
|
|
184
|
+
"src/pkg/protocol.test.ts"
|
|
185
|
+
],
|
|
186
|
+
"rules": {
|
|
187
|
+
"jest/no-standalone-expect": "off",
|
|
188
|
+
"jest/no-conditional-expect": "off"
|
|
160
189
|
}
|
|
161
190
|
},
|
|
162
191
|
{
|