From e94eac9df7688b8742eac0ccd13bad897013bfbc Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 4 Jan 2023 14:42:54 +0100 Subject: Allow debugging "restored" games. --- tools/patchgame.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/patchgame.js b/tools/patchgame.js index 167aca9..d0a27f0 100644 --- a/tools/patchgame.js +++ b/tools/patchgame.js @@ -47,8 +47,11 @@ try { game = rules.setup(args[0], args[1], args[2]) else if (item.action === 'resign') game = rules.resign(game, item.role) - else { - console.log("ACTION", i, game.seed, game.state, game.active, ">", item.role, item.action, item.arguments) + else if (item.action === 'restore') { + game = JSON.parse(args) + console.log("RESTORE", i, game.state, game.active) + } else { + console.log("ACTION", i, game.state, game.active, ">", item.role, item.action, item.arguments) if (VERIFY) { if (!is_valid_action(rules, game, item.role, item.action, args)) { console.log(`invalid action: ${item.role} ${item.action} ${item.arguments}`) -- cgit v1.2.3