summaryrefslogtreecommitdiff
path: root/tools/rerun.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-11-06 13:25:16 +0100
committerTor Andersson <tor@ccxvii.net>2021-11-07 19:36:56 +0100
commit2fd3282e463f43b536facc5d6578acb5c3bbf95d (patch)
tree2a67cb7e61da723303a5a0e7e224c422a481aa81 /tools/rerun.js
parentdf3b42121f297c326fa8b481215252603c8937c4 (diff)
downloadserver-2fd3282e463f43b536facc5d6578acb5c3bbf95d.tar.gz
Clean up replay script.
Diffstat (limited to 'tools/rerun.js')
-rw-r--r--tools/rerun.js24
1 files changed, 0 insertions, 24 deletions
diff --git a/tools/rerun.js b/tools/rerun.js
deleted file mode 100644
index d1534e6..0000000
--- a/tools/rerun.js
+++ /dev/null
@@ -1,24 +0,0 @@
-const sqlite3 = require('better-sqlite3');
-
-let db = new sqlite3("./db");
-let game_id = process.argv[2] | 0;
-let title_id = db.prepare("SELECT title_id FROM games WHERE game_id = ?").pluck().get(game_id);
-let rules = require("./public/" + title_id + "/rules.js");
-
-console.log("// TITLE", title_id)
-let log = db.prepare("SELECT * FROM game_log WHERE game_id = ?").all(game_id);
-let game = null;
-log.forEach(item => {
- let args = JSON.parse(item.arguments);
- if (item.action === 'setup') {
- console.log("// SETUP", item.arguments)
- game = rules.setup(args[0], args[1], args[2]);
- } else if (item.action === 'resign') {
- console.log("// RESIGN", item.role);
- game = rules.resign(game, item.role);
- } else {
- console.log("// ACTION", item.role, item.action, item.arguments);
- game = rules.action(game, item.role, item.action, args);
- }
- console.log(JSON.stringify(game));
-});