Add script for testing move suggestions
This commit is contained in:
parent
3e52b6fb71
commit
58ae5a67f3
|
@ -0,0 +1,33 @@
|
|||
const fumen = require('tetris-fumen');
|
||||
const { argv } = require('node:process');
|
||||
const { fumenPageToInputState, fumenPagePlayMove, runFishCli } = require('./src/utils');
|
||||
|
||||
const CONFIG = [
|
||||
// '--limit-nodes', '1000',
|
||||
// '--limit-steps', '5',
|
||||
// '--limit-time', '1000',
|
||||
];
|
||||
|
||||
async function main() {
|
||||
if (argv.length != 3) {
|
||||
throw new Error('usage: node list <url>');
|
||||
}
|
||||
|
||||
let url = argv[2];
|
||||
let pages = fumen.decoder.decode(url);
|
||||
if (pages.length !== 1) {
|
||||
throw new Error('expected exactly one page');
|
||||
}
|
||||
|
||||
let inputState = fumenPageToInputState(pages[0]);
|
||||
let output = await runFishCli(['best', ...CONFIG], inputState);
|
||||
for (let move of output.moves) {
|
||||
pages.push(fumenPagePlayMove(pages[0], move, { lock: true }));
|
||||
}
|
||||
|
||||
pages.push({ comment: '' });
|
||||
|
||||
console.log(fumen.encoder.encode(pages));
|
||||
}
|
||||
|
||||
main().catch(e => console.error(e));
|
|
@ -0,0 +1 @@
|
|||
v115@lgA8CeA8OeA8CeC8BeC8BeC8AeE8AeC8AeN8AeA8Je?AgWZAFLDmClcJSAVzbSAVG88AYP88A5sjxCvAAAA
|
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env sh
|
||||
exec cargo build --manifest-path ../fish/Cargo.toml --release --features=fish-cli
|
Loading…
Reference in New Issue