mons-rust 0.1.21 → 0.1.23
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/README.md +1 -3
- package/mons-web.d.ts +455 -0
- package/mons-web.js +1226 -0
- package/mons-web_bg.wasm +0 -0
- package/package.json +19 -28
package/README.md
CHANGED
package/mons-web.d.ts
ADDED
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* @param {string} fen_w
|
|
5
|
+
* @param {string} fen_b
|
|
6
|
+
* @param {string} flat_moves_string_w
|
|
7
|
+
* @param {string} flat_moves_string_b
|
|
8
|
+
* @returns {string}
|
|
9
|
+
*/
|
|
10
|
+
export function winner(fen_w: string, fen_b: string, flat_moves_string_w: string, flat_moves_string_b: string): string;
|
|
11
|
+
/**
|
|
12
|
+
*/
|
|
13
|
+
export enum Color {
|
|
14
|
+
White = 0,
|
|
15
|
+
Black = 1,
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
*/
|
|
19
|
+
export enum AvailableMoveKind {
|
|
20
|
+
MonMove = 0,
|
|
21
|
+
ManaMove = 1,
|
|
22
|
+
Action = 2,
|
|
23
|
+
Potion = 3,
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
*/
|
|
27
|
+
export enum OutputModelKind {
|
|
28
|
+
InvalidInput = 0,
|
|
29
|
+
LocationsToStartFrom = 1,
|
|
30
|
+
NextInputOptions = 2,
|
|
31
|
+
Events = 3,
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
*/
|
|
35
|
+
export enum NextInputKind {
|
|
36
|
+
MonMove = 0,
|
|
37
|
+
ManaMove = 1,
|
|
38
|
+
MysticAction = 2,
|
|
39
|
+
DemonAction = 3,
|
|
40
|
+
DemonAdditionalStep = 4,
|
|
41
|
+
SpiritTargetCapture = 5,
|
|
42
|
+
SpiritTargetMove = 6,
|
|
43
|
+
SelectConsumable = 7,
|
|
44
|
+
BombAttack = 8,
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
*/
|
|
48
|
+
export enum ItemModelKind {
|
|
49
|
+
Mon = 0,
|
|
50
|
+
Mana = 1,
|
|
51
|
+
MonWithMana = 2,
|
|
52
|
+
MonWithConsumable = 3,
|
|
53
|
+
Consumable = 4,
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
*/
|
|
57
|
+
export enum SquareModelKind {
|
|
58
|
+
Regular = 0,
|
|
59
|
+
ConsumableBase = 1,
|
|
60
|
+
SupermanaBase = 2,
|
|
61
|
+
ManaBase = 3,
|
|
62
|
+
ManaPool = 4,
|
|
63
|
+
MonBase = 5,
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
*/
|
|
67
|
+
export enum ManaKind {
|
|
68
|
+
Regular = 0,
|
|
69
|
+
Supermana = 1,
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
*/
|
|
73
|
+
export enum Consumable {
|
|
74
|
+
Potion = 0,
|
|
75
|
+
Bomb = 1,
|
|
76
|
+
BombOrPotion = 2,
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
*/
|
|
80
|
+
export enum MonKind {
|
|
81
|
+
Demon = 0,
|
|
82
|
+
Drainer = 1,
|
|
83
|
+
Angel = 2,
|
|
84
|
+
Spirit = 3,
|
|
85
|
+
Mystic = 4,
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
*/
|
|
89
|
+
export enum EventModelKind {
|
|
90
|
+
MonMove = 0,
|
|
91
|
+
ManaMove = 1,
|
|
92
|
+
ManaScored = 2,
|
|
93
|
+
MysticAction = 3,
|
|
94
|
+
DemonAction = 4,
|
|
95
|
+
DemonAdditionalStep = 5,
|
|
96
|
+
SpiritTargetMove = 6,
|
|
97
|
+
PickupBomb = 7,
|
|
98
|
+
PickupPotion = 8,
|
|
99
|
+
PickupMana = 9,
|
|
100
|
+
MonFainted = 10,
|
|
101
|
+
ManaDropped = 11,
|
|
102
|
+
SupermanaBackToBase = 12,
|
|
103
|
+
BombAttack = 13,
|
|
104
|
+
MonAwake = 14,
|
|
105
|
+
BombExplosion = 15,
|
|
106
|
+
NextTurn = 16,
|
|
107
|
+
GameOver = 17,
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
*/
|
|
111
|
+
export enum Modifier {
|
|
112
|
+
SelectPotion = 0,
|
|
113
|
+
SelectBomb = 1,
|
|
114
|
+
Cancel = 2,
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
*/
|
|
118
|
+
export class EventModel {
|
|
119
|
+
free(): void;
|
|
120
|
+
/**
|
|
121
|
+
*/
|
|
122
|
+
color?: Color;
|
|
123
|
+
/**
|
|
124
|
+
*/
|
|
125
|
+
item?: ItemModel;
|
|
126
|
+
/**
|
|
127
|
+
*/
|
|
128
|
+
kind: EventModelKind;
|
|
129
|
+
/**
|
|
130
|
+
*/
|
|
131
|
+
loc1?: Location;
|
|
132
|
+
/**
|
|
133
|
+
*/
|
|
134
|
+
loc2?: Location;
|
|
135
|
+
/**
|
|
136
|
+
*/
|
|
137
|
+
mana?: ManaModel;
|
|
138
|
+
/**
|
|
139
|
+
*/
|
|
140
|
+
mon?: Mon;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
*/
|
|
144
|
+
export class ItemModel {
|
|
145
|
+
free(): void;
|
|
146
|
+
/**
|
|
147
|
+
*/
|
|
148
|
+
consumable?: Consumable;
|
|
149
|
+
/**
|
|
150
|
+
*/
|
|
151
|
+
kind: ItemModelKind;
|
|
152
|
+
/**
|
|
153
|
+
*/
|
|
154
|
+
mana?: ManaModel;
|
|
155
|
+
/**
|
|
156
|
+
*/
|
|
157
|
+
mon?: Mon;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
*/
|
|
161
|
+
export class Location {
|
|
162
|
+
free(): void;
|
|
163
|
+
/**
|
|
164
|
+
* @param {number} i
|
|
165
|
+
* @param {number} j
|
|
166
|
+
*/
|
|
167
|
+
constructor(i: number, j: number);
|
|
168
|
+
/**
|
|
169
|
+
*/
|
|
170
|
+
i: number;
|
|
171
|
+
/**
|
|
172
|
+
*/
|
|
173
|
+
j: number;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
*/
|
|
177
|
+
export class ManaModel {
|
|
178
|
+
free(): void;
|
|
179
|
+
/**
|
|
180
|
+
*/
|
|
181
|
+
color: Color;
|
|
182
|
+
/**
|
|
183
|
+
*/
|
|
184
|
+
kind: ManaKind;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
*/
|
|
188
|
+
export class Mon {
|
|
189
|
+
free(): void;
|
|
190
|
+
/**
|
|
191
|
+
* @param {MonKind} kind
|
|
192
|
+
* @param {Color} color
|
|
193
|
+
* @param {number} cooldown
|
|
194
|
+
* @returns {Mon}
|
|
195
|
+
*/
|
|
196
|
+
static new(kind: MonKind, color: Color, cooldown: number): Mon;
|
|
197
|
+
/**
|
|
198
|
+
* @returns {boolean}
|
|
199
|
+
*/
|
|
200
|
+
is_fainted(): boolean;
|
|
201
|
+
/**
|
|
202
|
+
*/
|
|
203
|
+
faint(): void;
|
|
204
|
+
/**
|
|
205
|
+
*/
|
|
206
|
+
decrease_cooldown(): void;
|
|
207
|
+
/**
|
|
208
|
+
*/
|
|
209
|
+
color: Color;
|
|
210
|
+
/**
|
|
211
|
+
*/
|
|
212
|
+
cooldown: number;
|
|
213
|
+
/**
|
|
214
|
+
*/
|
|
215
|
+
kind: MonKind;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
*/
|
|
219
|
+
export class MonsGameModel {
|
|
220
|
+
free(): void;
|
|
221
|
+
/**
|
|
222
|
+
* @returns {MonsGameModel}
|
|
223
|
+
*/
|
|
224
|
+
static new(): MonsGameModel;
|
|
225
|
+
/**
|
|
226
|
+
* @param {string} fen
|
|
227
|
+
* @returns {MonsGameModel | undefined}
|
|
228
|
+
*/
|
|
229
|
+
static from_fen(fen: string): MonsGameModel | undefined;
|
|
230
|
+
/**
|
|
231
|
+
* @returns {string}
|
|
232
|
+
*/
|
|
233
|
+
fen(): string;
|
|
234
|
+
/**
|
|
235
|
+
* @param {(Location)[]} locations
|
|
236
|
+
* @param {Modifier | undefined} [modifier]
|
|
237
|
+
* @returns {OutputModel}
|
|
238
|
+
*/
|
|
239
|
+
process_input(locations: (Location)[], modifier?: Modifier): OutputModel;
|
|
240
|
+
/**
|
|
241
|
+
* @param {string} input_fen
|
|
242
|
+
* @returns {OutputModel}
|
|
243
|
+
*/
|
|
244
|
+
process_input_fen(input_fen: string): OutputModel;
|
|
245
|
+
/**
|
|
246
|
+
* @param {Location} at
|
|
247
|
+
* @returns {ItemModel | undefined}
|
|
248
|
+
*/
|
|
249
|
+
item(at: Location): ItemModel | undefined;
|
|
250
|
+
/**
|
|
251
|
+
* @param {Location} at
|
|
252
|
+
* @returns {SquareModel}
|
|
253
|
+
*/
|
|
254
|
+
square(at: Location): SquareModel;
|
|
255
|
+
/**
|
|
256
|
+
* @param {string} other_fen
|
|
257
|
+
* @returns {boolean}
|
|
258
|
+
*/
|
|
259
|
+
is_later_than(other_fen: string): boolean;
|
|
260
|
+
/**
|
|
261
|
+
* @returns {Color}
|
|
262
|
+
*/
|
|
263
|
+
active_color(): Color;
|
|
264
|
+
/**
|
|
265
|
+
* @returns {Color | undefined}
|
|
266
|
+
*/
|
|
267
|
+
winner_color(): Color | undefined;
|
|
268
|
+
/**
|
|
269
|
+
* @returns {number}
|
|
270
|
+
*/
|
|
271
|
+
black_score(): number;
|
|
272
|
+
/**
|
|
273
|
+
* @returns {number}
|
|
274
|
+
*/
|
|
275
|
+
white_score(): number;
|
|
276
|
+
/**
|
|
277
|
+
* @returns {Int32Array}
|
|
278
|
+
*/
|
|
279
|
+
available_move_kinds(): Int32Array;
|
|
280
|
+
/**
|
|
281
|
+
* @returns {(Location)[]}
|
|
282
|
+
*/
|
|
283
|
+
locations_with_content(): (Location)[];
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
*/
|
|
287
|
+
export class NextInputModel {
|
|
288
|
+
free(): void;
|
|
289
|
+
/**
|
|
290
|
+
*/
|
|
291
|
+
actor_mon_item?: ItemModel;
|
|
292
|
+
/**
|
|
293
|
+
*/
|
|
294
|
+
kind: NextInputKind;
|
|
295
|
+
/**
|
|
296
|
+
*/
|
|
297
|
+
location?: Location;
|
|
298
|
+
/**
|
|
299
|
+
*/
|
|
300
|
+
modifier?: Modifier;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
*/
|
|
304
|
+
export class OutputModel {
|
|
305
|
+
free(): void;
|
|
306
|
+
/**
|
|
307
|
+
* @returns {(Location)[]}
|
|
308
|
+
*/
|
|
309
|
+
locations(): (Location)[];
|
|
310
|
+
/**
|
|
311
|
+
* @returns {(NextInputModel)[]}
|
|
312
|
+
*/
|
|
313
|
+
next_inputs(): (NextInputModel)[];
|
|
314
|
+
/**
|
|
315
|
+
* @returns {(EventModel)[]}
|
|
316
|
+
*/
|
|
317
|
+
events(): (EventModel)[];
|
|
318
|
+
/**
|
|
319
|
+
* @returns {string}
|
|
320
|
+
*/
|
|
321
|
+
input_fen(): string;
|
|
322
|
+
/**
|
|
323
|
+
*/
|
|
324
|
+
kind: OutputModelKind;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
*/
|
|
328
|
+
export class SquareModel {
|
|
329
|
+
free(): void;
|
|
330
|
+
/**
|
|
331
|
+
*/
|
|
332
|
+
color?: Color;
|
|
333
|
+
/**
|
|
334
|
+
*/
|
|
335
|
+
kind: SquareModelKind;
|
|
336
|
+
/**
|
|
337
|
+
*/
|
|
338
|
+
mon_kind?: MonKind;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
342
|
+
|
|
343
|
+
export interface InitOutput {
|
|
344
|
+
readonly memory: WebAssembly.Memory;
|
|
345
|
+
readonly __wbg_monsgamemodel_free: (a: number) => void;
|
|
346
|
+
readonly monsgamemodel_new: () => number;
|
|
347
|
+
readonly monsgamemodel_from_fen: (a: number, b: number) => number;
|
|
348
|
+
readonly monsgamemodel_fen: (a: number, b: number) => void;
|
|
349
|
+
readonly monsgamemodel_process_input: (a: number, b: number, c: number, d: number) => number;
|
|
350
|
+
readonly monsgamemodel_process_input_fen: (a: number, b: number, c: number) => number;
|
|
351
|
+
readonly monsgamemodel_item: (a: number, b: number) => number;
|
|
352
|
+
readonly monsgamemodel_square: (a: number, b: number) => number;
|
|
353
|
+
readonly monsgamemodel_is_later_than: (a: number, b: number, c: number) => number;
|
|
354
|
+
readonly monsgamemodel_active_color: (a: number) => number;
|
|
355
|
+
readonly monsgamemodel_winner_color: (a: number) => number;
|
|
356
|
+
readonly monsgamemodel_black_score: (a: number) => number;
|
|
357
|
+
readonly monsgamemodel_white_score: (a: number) => number;
|
|
358
|
+
readonly monsgamemodel_available_move_kinds: (a: number, b: number) => void;
|
|
359
|
+
readonly monsgamemodel_locations_with_content: (a: number, b: number) => void;
|
|
360
|
+
readonly __wbg_outputmodel_free: (a: number) => void;
|
|
361
|
+
readonly __wbg_get_outputmodel_kind: (a: number) => number;
|
|
362
|
+
readonly __wbg_set_outputmodel_kind: (a: number, b: number) => void;
|
|
363
|
+
readonly outputmodel_locations: (a: number, b: number) => void;
|
|
364
|
+
readonly outputmodel_next_inputs: (a: number, b: number) => void;
|
|
365
|
+
readonly outputmodel_events: (a: number, b: number) => void;
|
|
366
|
+
readonly outputmodel_input_fen: (a: number, b: number) => void;
|
|
367
|
+
readonly __wbg_get_squaremodel_kind: (a: number) => number;
|
|
368
|
+
readonly __wbg_set_squaremodel_kind: (a: number, b: number) => void;
|
|
369
|
+
readonly __wbg_get_squaremodel_color: (a: number) => number;
|
|
370
|
+
readonly __wbg_set_squaremodel_color: (a: number, b: number) => void;
|
|
371
|
+
readonly __wbg_get_squaremodel_mon_kind: (a: number) => number;
|
|
372
|
+
readonly __wbg_set_squaremodel_mon_kind: (a: number, b: number) => void;
|
|
373
|
+
readonly __wbg_itemmodel_free: (a: number) => void;
|
|
374
|
+
readonly __wbg_get_itemmodel_kind: (a: number) => number;
|
|
375
|
+
readonly __wbg_set_itemmodel_kind: (a: number, b: number) => void;
|
|
376
|
+
readonly __wbg_get_itemmodel_mon: (a: number) => number;
|
|
377
|
+
readonly __wbg_set_itemmodel_mon: (a: number, b: number) => void;
|
|
378
|
+
readonly __wbg_get_itemmodel_mana: (a: number) => number;
|
|
379
|
+
readonly __wbg_set_itemmodel_mana: (a: number, b: number) => void;
|
|
380
|
+
readonly __wbg_get_itemmodel_consumable: (a: number) => number;
|
|
381
|
+
readonly __wbg_set_itemmodel_consumable: (a: number, b: number) => void;
|
|
382
|
+
readonly __wbg_manamodel_free: (a: number) => void;
|
|
383
|
+
readonly __wbg_get_manamodel_kind: (a: number) => number;
|
|
384
|
+
readonly __wbg_set_manamodel_kind: (a: number, b: number) => void;
|
|
385
|
+
readonly __wbg_get_manamodel_color: (a: number) => number;
|
|
386
|
+
readonly __wbg_set_manamodel_color: (a: number, b: number) => void;
|
|
387
|
+
readonly __wbg_nextinputmodel_free: (a: number) => void;
|
|
388
|
+
readonly __wbg_get_nextinputmodel_modifier: (a: number) => number;
|
|
389
|
+
readonly __wbg_set_nextinputmodel_modifier: (a: number, b: number) => void;
|
|
390
|
+
readonly __wbg_get_nextinputmodel_kind: (a: number) => number;
|
|
391
|
+
readonly __wbg_set_nextinputmodel_kind: (a: number, b: number) => void;
|
|
392
|
+
readonly __wbg_get_nextinputmodel_actor_mon_item: (a: number) => number;
|
|
393
|
+
readonly __wbg_set_nextinputmodel_actor_mon_item: (a: number, b: number) => void;
|
|
394
|
+
readonly __wbg_eventmodel_free: (a: number) => void;
|
|
395
|
+
readonly __wbg_get_eventmodel_kind: (a: number) => number;
|
|
396
|
+
readonly __wbg_set_eventmodel_kind: (a: number, b: number) => void;
|
|
397
|
+
readonly __wbg_get_eventmodel_item: (a: number) => number;
|
|
398
|
+
readonly __wbg_set_eventmodel_item: (a: number, b: number) => void;
|
|
399
|
+
readonly __wbg_get_eventmodel_mon: (a: number) => number;
|
|
400
|
+
readonly __wbg_set_eventmodel_mon: (a: number, b: number) => void;
|
|
401
|
+
readonly __wbg_get_eventmodel_mana: (a: number) => number;
|
|
402
|
+
readonly __wbg_set_eventmodel_mana: (a: number, b: number) => void;
|
|
403
|
+
readonly __wbg_get_eventmodel_loc1: (a: number) => number;
|
|
404
|
+
readonly __wbg_set_eventmodel_loc1: (a: number, b: number) => void;
|
|
405
|
+
readonly __wbg_get_eventmodel_loc2: (a: number) => number;
|
|
406
|
+
readonly __wbg_set_eventmodel_loc2: (a: number, b: number) => void;
|
|
407
|
+
readonly __wbg_get_eventmodel_color: (a: number) => number;
|
|
408
|
+
readonly __wbg_set_eventmodel_color: (a: number, b: number) => void;
|
|
409
|
+
readonly __wbg_get_nextinputmodel_location: (a: number) => number;
|
|
410
|
+
readonly __wbg_set_nextinputmodel_location: (a: number, b: number) => void;
|
|
411
|
+
readonly __wbg_squaremodel_free: (a: number) => void;
|
|
412
|
+
readonly __wbg_mon_free: (a: number) => void;
|
|
413
|
+
readonly __wbg_get_mon_kind: (a: number) => number;
|
|
414
|
+
readonly __wbg_set_mon_kind: (a: number, b: number) => void;
|
|
415
|
+
readonly __wbg_get_mon_color: (a: number) => number;
|
|
416
|
+
readonly __wbg_set_mon_color: (a: number, b: number) => void;
|
|
417
|
+
readonly __wbg_get_mon_cooldown: (a: number) => number;
|
|
418
|
+
readonly __wbg_set_mon_cooldown: (a: number, b: number) => void;
|
|
419
|
+
readonly mon_new: (a: number, b: number, c: number) => number;
|
|
420
|
+
readonly mon_is_fainted: (a: number) => number;
|
|
421
|
+
readonly mon_faint: (a: number) => void;
|
|
422
|
+
readonly mon_decrease_cooldown: (a: number) => void;
|
|
423
|
+
readonly __wbg_location_free: (a: number) => void;
|
|
424
|
+
readonly __wbg_get_location_i: (a: number) => number;
|
|
425
|
+
readonly __wbg_set_location_i: (a: number, b: number) => void;
|
|
426
|
+
readonly __wbg_get_location_j: (a: number) => number;
|
|
427
|
+
readonly __wbg_set_location_j: (a: number, b: number) => void;
|
|
428
|
+
readonly location_new: (a: number, b: number) => number;
|
|
429
|
+
readonly winner: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
430
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
431
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
432
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
433
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
437
|
+
/**
|
|
438
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
439
|
+
* a precompiled `WebAssembly.Module`.
|
|
440
|
+
*
|
|
441
|
+
* @param {SyncInitInput} module
|
|
442
|
+
*
|
|
443
|
+
* @returns {InitOutput}
|
|
444
|
+
*/
|
|
445
|
+
export function initSync(module: SyncInitInput): InitOutput;
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
449
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
450
|
+
*
|
|
451
|
+
* @param {InitInput | Promise<InitInput>} module_or_path
|
|
452
|
+
*
|
|
453
|
+
* @returns {Promise<InitOutput>}
|
|
454
|
+
*/
|
|
455
|
+
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|